shortest_paths
Algorithms to calculate shortest paths in static networks
The functions in this module allow to compute shortest paths in static networks.
avg_path_length
¶
Compute the average path length of the graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
pathpyG.core.graph.Graph
|
Input graph. |
required |
Returns: float: The average path length of the graph.
Source code in src/pathpyG/algorithms/shortest_paths.py
diameter
¶
shortest_paths_dijkstra
¶
Compute shortest paths using Dijkstra's algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
pathpyG.core.graph.Graph
|
Input graph. |
required |
Returns:
| Type | Description |
|---|---|
tuple[numpy.ndarray, numpy.ndarray]
|
tuple[np.ndarray, np.ndarray]: A tuple containing the distance matrix and the predecessor matrix. |