xgi.algorithms.shortest_path
Algorithms for computing shortest paths in a hypergraph.
Functions
- xgi.algorithms.shortest_path.single_source_shortest_path_length(H, source)[source]
Returns the distances from source to every other node in hypergraph H.
- Parameters:
H (xgi.Hypergraph) – Hypergraph on which to compute the distances. Node indexes must be integers.
source (int) – Index of the node from which to compute the distance to every other node.
- Returns:
dists – Dictionary where keys are node indexes and values are the distances from source.
- Return type:
dict
- xgi.algorithms.shortest_path.shortest_path_length(H)[source]
Returns a generator of tuples (source, dists) where dists is a dictonary containing the distances from source to every other node in hypergraph H, for all possible source in H.
- Parameters:
H (xgi.Hypergraph) – Hypergraph on which to compute the distances. Node indexes must be integers.
- Returns:
paths – Every tuple is of the form (source, dict_of_lengths), for every possible source.
- Return type:
generator of tuples