brainconn.distance
.retrieve_shortest_path¶
-
retrieve_shortest_path
(s, t, hops, Pmat)[source]¶ Returns nodes comprising shortest path between s and t
This function finds the sequence of nodes that comprise the shortest path between a given source and target node.
Parameters: - s (int) – Source node, i.e. node where the shortest path begins
- t (int) – Target node, i.e. node where the shortest path ends
- hops ((N x N) array_like) – Number of edges in the path. This array may be obtained as the second output argument of the function distance_wei_floyd.
- Pmat ((N x N) array_like) – Array whose elements Pmat[k,t] indicate the next node in the shortest path between nodes k and t. This array may be obtained as the third output of the function distance_wei_floyd.
Returns: path – Nodes (indices) comprising the shortest path between s and t
Return type: ndarray
Notes
Originally written in Matlab by Andrea Avena-Koenigsberger and Joaquin Goni (IU, 2012)