netneurotools.metrics.distance_wei_floyd
- netneurotools.metrics.distance_wei_floyd(D)[source]
Compute the all-pairs shortest path length using Floyd-Warshall algorithm.
- Parameters:
D ((N, N) array_like) – Connection length or distance matrix. Please do the weight-to-distance beforehand.
- Returns:
spl_mat ((N, N) array_like) – Shortest path length matrix
p_mat ((N, N) array_like) – Predecessor matrix returned from scipy.sparse.csgraph.shortest_path
Notes
This function is a wrapper for scipy.sparse.csgraph.shortest_path. There may be more than one shortest path between two nodes, and we only return the first one found by the algorithm.
References