Browse Source

Correction of minor bug on shortest paths computations

v0.1
Benoit GAUZERE 7 years ago
parent
commit
0b2e8ce08f
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      pygraph/utils/utils.py

+ 3
- 2
pygraph/utils/utils.py View File

@@ -5,6 +5,7 @@ import numpy as np
def getSPLengths(G1):
sp = nx.shortest_path(G1)
distances = np.zeros((G1.number_of_nodes(), G1.number_of_nodes()))
for i in np.keys():
for j in np[i].keys():
for i in sp.keys():
for j in sp[i].keys():
distances[i, j] = len(sp[i][j])-1
return distances

Loading…
Cancel
Save