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§
- AllShortest
Paths - Result of
get_all_shortest_paths/get_all_shortest_paths_with_mode. - AllShortest
Paths Dijkstra - Result of
get_all_shortest_paths_dijkstra. - Dijkstra
AllPaths - Output of
dijkstra_all_shortest_paths. - Dijkstra
Paths - Output of
dijkstra_paths.parents[v]is the predecessor ofvalong the shortest-path tree from the single source (orNonefor the source itself and for unreachable vertices — the caller can disambiguate viadistances[v]).inbound_edges[v]is the edge idvwas reached through;Nonefor the source and unreachable vertices. - Eulerian
Classification - Whether an Eulerian path or cycle exists in a graph.
- KShortest
Path - Result of
k_shortest_paths. - Path
Length Hist Result - Result of
path_length_hist. - Pseudo
Diameter Result - Result of the pseudo-diameter computation.
- Shortest
Path - A single shortest path: the vertex sequence (including
fromandto) and the edge sequence along it. For a path ofkvertices the edge vector hask - 1entries. - Shortest
Paths Dijkstra - Result of
get_shortest_paths_dijkstra: vertex and edge paths from a single source to all vertices. - Voronoi
Partition - Result of
voronoi: the Voronoi cell each vertex belongs to plus the distance to its assigned generator.
Enums§
- AllShortest
Paths Mode - Direction mode for
get_all_shortest_pathsandget_all_shortest_paths_with_mode. - Dijkstra
Mode - Direction selector for the mode-aware Dijkstra entry points
(SP-001c). Counterpart of
igraph_neimode_trestricted to the three valuesigraph_distances_dijkstraaccepts. For undirected graphs every variant collapses toDijkstraMode::All(every edge is bidirectional). - Distances
Cutoff Mode - Direction mode for cutoff-aware unweighted distance functions.
- Distances
From Mode - Direction mode for
distances_from_with_mode. - Distances
Mode - Direction mode for
distances_all_with_mode. - Shortest
Path Mode - Direction mode for
get_shortest_paths_with_mode. - Simple
Path Mode - Mode for traversing neighbors in directed graphs.
- Voronoi
Tiebreaker - Tie-breaking rule used when two or more generators reach a vertex at the same distance.
- Walk
Mode - Direction mode for edge-path traversal.
Functions§
- a_
star_ path - Single-source single-target shortest path using A*.
- all_
simple_ paths - Enumerate all simple paths from
fromto vertices into. - diameter
- Diameter of
graph— the maximum vertex eccentricity.Nonefor a graph with no vertices. - diameter_
weighted - OUT-mode default for
diameter_weighted_with_mode. - diameter_
weighted_ with_ mode - Mode-aware weighted diameter.
Noneforvcount == 0. - dijkstra_
all_ shortest_ paths - All shortest weighted paths from
sourceto every vertex, preserving every tie. Counterpart ofigraph_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. Whencutoff = Some(c), vertices whose shortest-path distance exceedscare returned asNone(unreachable-within-cutoff); the search stops relaxing edges out of any vertex whosemindist > c. - dijkstra_
distances_ cutoff_ with_ mode - Mode-aware
dijkstra_distances_cutoff. Counterpart ofigraph_distances_dijkstra_cutoff(_, _, source, vss_all(), weights, mode, cutoff). - dijkstra_
distances_ multi - Multi-source Dijkstra distances.
result[i][v]is the shortest distance fromsources[i]tov(orNoneif 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)iftargetis unreachable; the source vertex appears as the first element when reachable. - dijkstra_
path_ to_ with_ mode - Mode-aware
dijkstra_path_to. Counterpart ofigraph_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 ofigraph_get_shortest_paths_dijkstra(_, _, _, source, vss_all(), weights, mode, parents, inbound_edges). - distances
- Unweighted shortest-path lengths from
sourceto every vertex. - distances_
all - All-pairs unweighted shortest distances.
- distances_
all_ with_ mode - All-pairs shortest distances with direction control.
- distances_
cutoff - Unweighted shortest-path lengths from
sourceto every vertex, ignoring paths longer thancutoff. - distances_
cutoff_ multi - Multi-source unweighted distances with cutoff, direction-aware.
- distances_
cutoff_ with_ mode - Mode-aware
distances_cutoff. For undirected graphsmodeis ignored. - distances_
from - Compute shortest-path distances from multiple sources to all vertices.
- distances_
from_ with_ mode - Compute shortest-path distances from multiple sources with direction control.
- eccentricity
- Eccentricity of every vertex (length
vcount). Resultr[v]is the maximum shortest-path distance fromvto any reachable vertex. Isolated vertices have eccentricity0. - eccentricity_
weighted - OUT-mode default for
eccentricity_weighted_with_mode. Counterpart ofigraph_eccentricity(_, weights, _, igraph_vss_all(), IGRAPH_OUT). - eccentricity_
weighted_ with_ mode - Mode-aware weighted eccentricity. For each vertex
v, returnsmax_{u reachable from v} dist(v, u), where distances are weighted shortest-path lengths (Dijkstra). Unreachable vertex pairs are ignored (matches upstream’sunconn=true); isolated vertices have eccentricity0.0. - eulerian_
cycle - Build an Eulerian cycle if one exists, or return an error.
- eulerian_
path - Build an Eulerian path or cycle for
graphif one exists. ReturnsSome(edge_ids)(the walk visits each edge exactly once) orNoneif no Eulerian walk exists. - floyd_
warshall_ distances - All-pairs shortest distances via Floyd-Warshall.
- get_
all_ shortest_ paths - Find all shortest paths from
sourceto every reachable vertex. - get_
all_ shortest_ paths_ dijkstra - Find all shortest paths from
sourceto every reachable vertex using Dijkstra’s algorithm with non-negative edge weights. - get_
all_ shortest_ paths_ dijkstra_ with_ mode - Find all shortest paths from
sourcewith direction control. - get_
all_ shortest_ paths_ with_ mode - Find all shortest paths from
sourcewith direction control. - get_
shortest_ path - Calculate a single shortest path from
fromtoto. - get_
shortest_ path_ astar - Calculate a single shortest path from
fromtotousing A*. - get_
shortest_ paths - Returns one shortest path from
sourceto every vertex in the graph. - get_
shortest_ paths_ dijkstra - Returns one shortest path from
sourceto every vertex in the graph, using weighted edges (Dijkstra’s algorithm). - get_
shortest_ paths_ dijkstra_ with_ mode - Mode-aware
get_shortest_paths_dijkstra. - get_
shortest_ paths_ with_ mode - Returns one shortest path from
sourceto every vertex, with direction control for directed graphs. - graph_
center - Return the central vertices of a graph — those with minimum eccentricity.
- is_
eulerian - Decide whether
graphhas an Eulerian path and/or cycle. - k_
shortest_ paths - Finds the k shortest loopless paths between
sourceandtarget. - path_
length_ hist - Compute a histogram of all shortest-path lengths.
- pseudo_
diameter - Approximate the diameter of a graph using pseudo-peripheral vertex search.
- radius
- Radius of
graph— the minimum vertex eccentricity.Nonefor a graph with no vertices (matches upstream’sIGRAPH_NANfor the null graph). - radius_
weighted - OUT-mode default for
radius_weighted_with_mode. - radius_
weighted_ with_ mode - Mode-aware weighted radius.
Noneforvcount == 0. - random_
walk - Random walk on
graphstarting atstart, taking up tostepstransitions. - random_
walk_ node2vec - Performs a second-order biased random walk (
Node2Vec) starting atstartfor up tostepstransitions. - random_
walks - Generate multiple random walks from every vertex in the graph.
- random_
walks_ from - Generate random walks from a specific set of starting vertices.
- random_
walks_ node2vec - Generate multiple
Node2Vecrandom walks from every vertex. - spanner
- Compute a t-spanner of the graph.
- vertex_
path_ from_ edge_ path - Convert an edge path to a vertex path.
- voronoi
- Voronoi partitioning of a graph from a set of generator vertices.
Type Aliases§
- Astar
Heuristic - A heuristic estimating the distance from a candidate vertex (first argument) to the target vertex (second argument). Must be admissible (never overestimate the true remaining distance) for the result to be a true shortest path.
- Node2
VecWalk Result - Result of a
Node2Vecrandom walk: the vertex chain and the edge chain.