Commit d6abcc24 authored by Benoit GAUZERE's avatar Benoit GAUZERE

Minor bug on traversal of shortest path list inutils.py

parent 4cd3654e
...@@ -5,8 +5,8 @@ import numpy as np ...@@ -5,8 +5,8 @@ import numpy as np
def getSPLengths(G1): def getSPLengths(G1):
sp = nx.shortest_path(G1) sp = nx.shortest_path(G1)
distances = np.zeros((G1.number_of_nodes(), G1.number_of_nodes())) distances = np.zeros((G1.number_of_nodes(), G1.number_of_nodes()))
for i in np.keys(): for i in sp.keys():
for j in np[i].keys(): for j in sp[i].keys():
distances[i, j] = len(sp[i][j])-1 distances[i, j] = len(sp[i][j])-1
return distances return distances
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment