find_path#

find_path(network, pore_pairs, weights=None)[source]#

Find the shortest path between pairs of nodes

Parameters:
  • network (dict) – The network dictionary

  • pairs (array_like) – An N x 2 array containing N pairs of nodes between which the shortest path is sought

  • weights (ndarray, optional) – The edge weights to use when traversing the path. If not provided then 1’s will be used.

Returns:

paths – A dictionary containing 'node_paths' and 'edge_paths', each containing a list of lists indicating the path between each set of nodes given in pairs. An empty list indicates that no path was found between a given set of pairs.

Return type:

dict

Notes

The shortest path is found using Dijkstra’s algorithm included in the scipy.sparse.csgraph module