Skip to main content

Module paths

Module paths 

Source
Expand description

Path-related algorithms. Phase 1 entries: ALGO-SP-006 (unweighted single-source distances), ALGO-CC-040 (Eulerian path / cycle existence), ALGO-CC-041 (Eulerian path/cycle construction, undirected), ALGO-SP-020 (eccentricity / radius / diameter).

Structs§

DijkstraAllPaths
Output of dijkstra_all_shortest_paths.
DijkstraPaths
Output of dijkstra_paths. parents[v] is the predecessor of v along the shortest-path tree from the single source (or None for the source itself and for unreachable vertices — the caller can disambiguate via distances[v]). inbound_edges[v] is the edge id v was reached through; None for the source and unreachable vertices.
EulerianClassification
Whether an Eulerian path or cycle exists in a graph.

Enums§

DijkstraMode
Direction selector for the mode-aware Dijkstra entry points (SP-001c). Counterpart of igraph_neimode_t restricted to the three values igraph_distances_dijkstra accepts. For undirected graphs every variant collapses to DijkstraMode::All (every edge is bidirectional).

Functions§

a_star_path
Single-source single-target shortest path using A*.
diameter
Diameter of graph — the maximum vertex eccentricity. None for a graph with no vertices.
diameter_weighted
OUT-mode default for diameter_weighted_with_mode.
diameter_weighted_with_mode
Mode-aware weighted diameter. None for vcount == 0.
dijkstra_all_shortest_paths
All shortest weighted paths from source to every vertex, preserving every tie. Counterpart of igraph_get_all_shortest_paths_dijkstra(_, _, _, _, source, vss_all(), weights, mode).
dijkstra_distances
Single-source Dijkstra distances.
dijkstra_distances_cutoff
Single-source Dijkstra distances with an optional cutoff. When cutoff = Some(c), vertices whose shortest-path distance exceeds c are returned as None (unreachable-within-cutoff); the search stops relaxing edges out of any vertex whose mindist > c.
dijkstra_distances_cutoff_with_mode
Mode-aware dijkstra_distances_cutoff. Counterpart of igraph_distances_dijkstra_cutoff(_, _, source, vss_all(), weights, mode, cutoff).
dijkstra_distances_multi
Multi-source Dijkstra distances. result[i][v] is the shortest distance from sources[i] to v (or None if unreachable / past the cutoff).
dijkstra_distances_multi_with_mode
Mode-aware dijkstra_distances_multi.
dijkstra_distances_with_mode
Mode-aware Dijkstra distances. Counterpart of igraph_distances_dijkstra(_, _, source, vss_all(), weights, mode).
dijkstra_path_to
Reconstruct a single source-to-target path returning vertex and edge sequences. Ok(None) if target is unreachable; the source vertex appears as the first element when reachable.
dijkstra_path_to_with_mode
Mode-aware dijkstra_path_to. Counterpart of igraph_get_shortest_path_dijkstra(_, _, _, source, target, weights, mode).
dijkstra_paths
Single-source Dijkstra returning distances + parents + inbound edges over every vertex.
dijkstra_paths_with_mode
Mode-aware dijkstra_paths. Counterpart of igraph_get_shortest_paths_dijkstra(_, _, _, source, vss_all(), weights, mode, parents, inbound_edges).
distances
Unweighted shortest-path lengths from source to every vertex.
eccentricity
Eccentricity of every vertex (length vcount). Result r[v] is the maximum shortest-path distance from v to any reachable vertex. Isolated vertices have eccentricity 0.
eccentricity_weighted
OUT-mode default for eccentricity_weighted_with_mode. Counterpart of igraph_eccentricity(_, weights, _, igraph_vss_all(), IGRAPH_OUT).
eccentricity_weighted_with_mode
Mode-aware weighted eccentricity. For each vertex v, returns max_{u reachable from v} dist(v, u), where distances are weighted shortest-path lengths (Dijkstra). Unreachable vertex pairs are ignored (matches upstream’s unconn=true); isolated vertices have eccentricity 0.0.
eulerian_path
Build an Eulerian path or cycle for graph if one exists. Returns Some(edge_ids) (the walk visits each edge exactly once) or None if no Eulerian walk exists.
floyd_warshall_distances
All-pairs shortest distances via Floyd-Warshall.
is_eulerian
Decide whether graph has an Eulerian path and/or cycle.
radius
Radius of graph — the minimum vertex eccentricity. None for a graph with no vertices (matches upstream’s IGRAPH_NAN for the null graph).
radius_weighted
OUT-mode default for radius_weighted_with_mode.
radius_weighted_with_mode
Mode-aware weighted radius. None for vcount == 0.
random_walk
Random walk on graph starting at start, taking up to steps transitions.