netneurotools.metrics.retrieve_shortest_path

netneurotools.metrics.retrieve_shortest_path(s, t, p_mat)[source]

Return the shortest paths between two nodes.

Parameters:
  • s (int) – Source node

  • t (int) – Target node

  • p_mat ((N, N) array_like) – Predecessor matrix returned from distance_wei_floyd

Returns:

path – List of nodes in the shortest path from s to t. If no path exists, returns [-1].

Return type:

list of int