Skip to content

Instantly share code, notes, and snippets.

@wires
Created September 18, 2015 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wires/169407be87f1442589c2 to your computer and use it in GitHub Desktop.
Save wires/169407be87f1442589c2 to your computer and use it in GitHub Desktop.
{"distance_table":[[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[29170,0,29170,15583,29170,37178,29170,50285,29170,35919,29170,36620,29170,59085,29170,38507,29170,21171,29170,69006,29170,63712,29170,26939,29170,45902,29170,25115,25115,0,25115,15583,25115,37178,25115,50285,1942829,1942829,1942829,1942829],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[36468,15986,36468,0,36468,31574,36468,55820,36468,30853,36468,39965,36468,66946,36468,46368,36468,12548,36468,76867,36468,71573,36468,21335,36468,50326,36468,11309,11309,15986,11309,0,11309,31574,11309,55820,1932678,1932678,1932678,1932678],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[13007,37419,13007,31616,13007,0,13007,27605,13007,14689,13007,11750,13007,40276,13007,27169,13007,31724,13007,50197,13007,43899,13007,13433,13007,22111,13007,37242,37242,37419,37242,31616,37242,0,37242,27605,1958261,1958261,1958261,1958261],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[32719,51402,32719,55994,32719,28277,32719,0,32719,38778,32719,28902,32719,20046,32719,19454,32719,56102,32719,29967,32719,26094,32719,37811,32719,14222,32719,61620,61620,51402,61620,55994,61620,28277,61620,0,1982178,1982178,1982178,1982178],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[12314,35128,12314,31174,12314,14963,12314,38314,12314,0,12314,19350,12314,50985,12314,31576,12314,29794,12314,60906,12314,54608,12314,13196,12314,32820,12314,35312,35312,35128,35312,31174,35312,14963,35312,38314,1956331,1956331,1956331,1956331],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[11722,38398,11722,39631,11722,12356,11722,28351,11722,19084,11722,0,11722,41022,11722,21325,11722,39739,11722,50943,11722,44645,11722,21448,11722,22857,11722,45257,45257,38398,45257,39631,45257,12356,45257,28351,1966276,1966276,1966276,1966276],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[41655,60116,41655,68251,41655,41428,41655,20640,41655,51487,41655,41611,41655,0,41655,28168,41655,66871,41655,15354,41655,14358,41655,50520,41655,27560,41655,72389,72389,60116,72389,68251,72389,41428,72389,20640,1990892,1990892,1990892,1990892],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[20668,39129,20668,47264,20668,27765,20668,18457,20668,31944,20668,21370,20668,27257,20668,0,20668,45884,20668,37178,20668,31884,20668,36857,20668,11632,20668,51402,51402,39129,51402,47264,51402,27765,51402,18457,1969905,1969905,1969905,1969905],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[35066,21668,35066,12989,35066,31173,35066,55419,35066,29451,35066,39564,35066,65544,35066,44966,35066,0,35066,75465,35066,70171,35066,20934,35066,49925,35066,14622,14622,21668,14622,12989,14622,31173,14622,55419,1935641,1935641,1935641,1935641],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[50952,69413,50952,77548,50952,50725,50952,29937,50952,60784,50952,50908,50952,15544,50952,37465,50952,76168,50952,0,50952,12799,50952,59817,50952,36857,50952,81686,81686,69413,81686,77548,81686,50725,81686,29937,2000189,2000189,2000189,2000189],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[45228,63689,45228,71532,45228,44257,45228,25923,45228,54316,45228,44440,45228,13914,45228,31741,45228,70444,45228,12507,45228,0,45228,53349,45228,30389,45228,75962,75962,63689,75962,71532,75962,44257,75962,25923,1994465,1994465,1994465,1994465],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[22738,26985,22738,21182,22738,13090,22738,37336,22738,13196,22738,21481,22738,50007,22738,36900,22738,21290,22738,59928,22738,53630,22738,0,22738,31842,22738,26808,26808,26985,26808,21182,26808,13090,26808,37336,1947827,1947827,1947827,1947827],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[27016,46503,27016,50291,27016,23016,27016,13894,27016,33075,27016,23199,27016,27302,27016,11676,27016,50399,27016,37223,27016,30925,27016,32108,27016,0,27016,55917,55917,46503,55917,50291,55917,23016,55917,13894,1976936,1976936,1976936,1976936],[0,30206,0,36651,0,13279,0,32380,0,12034,0,12283,0,41180,0,20602,0,35271,0,51101,0,45807,0,22371,0,27365,0,40789,40789,30206,40789,36651,40789,13279,40789,32380,1960982,1960982,1960982,1960982],[40897,25602,40897,11193,40897,37004,40897,61250,40897,35282,40897,45395,40897,71375,40897,50797,40897,14411,40897,81296,40897,76002,40897,26765,40897,55756,40897,0,0,25602,0,11193,0,37004,0,61250,1925181,1925181,1925181,1925181],[40897,25602,40897,11193,40897,37004,40897,61250,40897,35282,40897,45395,40897,71375,40897,50797,40897,14411,40897,81296,40897,76002,40897,26765,40897,55756,40897,0,0,25602,0,11193,0,37004,0,61250,1925181,1925181,1925181,1925181],[29170,0,29170,15583,29170,37178,29170,50285,29170,35919,29170,36620,29170,59085,29170,38507,29170,21171,29170,69006,29170,63712,29170,26939,29170,45902,29170,25115,25115,0,25115,15583,25115,37178,25115,50285,1942829,1942829,1942829,1942829],[40897,25602,40897,11193,40897,37004,40897,61250,40897,35282,40897,45395,40897,71375,40897,50797,40897,14411,40897,81296,40897,76002,40897,26765,40897,55756,40897,0,0,25602,0,11193,0,37004,0,61250,1925181,1925181,1925181,1925181],[36468,15986,36468,0,36468,31574,36468,55820,36468,30853,36468,39965,36468,66946,36468,46368,36468,12548,36468,76867,36468,71573,36468,21335,36468,50326,36468,11309,11309,15986,11309,0,11309,31574,11309,55820,1932678,1932678,1932678,1932678],[40897,25602,40897,11193,40897,37004,40897,61250,40897,35282,40897,45395,40897,71375,40897,50797,40897,14411,40897,81296,40897,76002,40897,26765,40897,55756,40897,0,0,25602,0,11193,0,37004,0,61250,1925181,1925181,1925181,1925181],[13007,37419,13007,31616,13007,0,13007,27605,13007,14689,13007,11750,13007,40276,13007,27169,13007,31724,13007,50197,13007,43899,13007,13433,13007,22111,13007,37242,37242,37419,37242,31616,37242,0,37242,27605,1958261,1958261,1958261,1958261],[40897,25602,40897,11193,40897,37004,40897,61250,40897,35282,40897,45395,40897,71375,40897,50797,40897,14411,40897,81296,40897,76002,40897,26765,40897,55756,40897,0,0,25602,0,11193,0,37004,0,61250,1925181,1925181,1925181,1925181],[32719,51402,32719,55994,32719,28277,32719,0,32719,38778,32719,28902,32719,20046,32719,19454,32719,56102,32719,29967,32719,26094,32719,37811,32719,14222,32719,61620,61620,51402,61620,55994,61620,28277,61620,0,1982178,1982178,1982178,1982178],[1957661,1942285,1957661,1932875,1957661,1957841,1957661,1978776,1957661,1956119,1957661,1965111,1957661,1987576,1957661,1966998,1957661,1935248,1957661,1997497,1957661,1992203,1957661,1947602,1957661,1974393,1957661,1925700,1925700,1942285,1925700,1932875,1925700,1957841,1925700,1978776,0,0,0,0],[1957661,1942285,1957661,1932875,1957661,1957841,1957661,1978776,1957661,1956119,1957661,1965111,1957661,1987576,1957661,1966998,1957661,1935248,1957661,1997497,1957661,1992203,1957661,1947602,1957661,1974393,1957661,1925700,1925700,1942285,1925700,1932875,1925700,1957841,1925700,1978776,0,0,0,0],[1957661,1942285,1957661,1932875,1957661,1957841,1957661,1978776,1957661,1956119,1957661,1965111,1957661,1987576,1957661,1966998,1957661,1935248,1957661,1997497,1957661,1992203,1957661,1947602,1957661,1974393,1957661,1925700,1925700,1942285,1925700,1932875,1925700,1957841,1925700,1978776,0,0,0,0],[1957661,1942285,1957661,1932875,1957661,1957841,1957661,1978776,1957661,1956119,1957661,1965111,1957661,1987576,1957661,1966998,1957661,1935248,1957661,1997497,1957661,1992203,1957661,1947602,1957661,1974393,1957661,1925700,1925700,1942285,1925700,1932875,1925700,1957841,1925700,1978776,0,0,0,0]]}
import json
with open('distances.json','r') as f:
obj = json.load(f)
d = obj['distance_table']
n = len(d)
print "matrix with %d rows" % n
for row in d:
if not len(row) == n:
print "non square"
for i in range(40):
for j in range(40):
print("edge entry d(%d,%d) = %d" % (i, j, d[i][j]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment