Skip to main content

Crate rust_igraph

Crate rust_igraph 

Source
Expand description

§rust-igraph

Pure-Rust, high-performance graph and network analysis library.

A faithful port of igraph with 370+ public APIs, zero unsafe, and no C/C++ FFI. Built for researchers, data scientists, and systems engineers who need production-grade graph algorithms in the Rust ecosystem.

§Feature overview

CategoryHighlights
TraversalBFS, DFS, topological sort, random walks
Shortest pathsDijkstra, Bellman-Ford, A*, all-pairs
Centralitybetweenness, closeness, eigenvector, PageRank, HITS
CommunityLouvain, Leiden, label propagation, Walktrap, fast greedy
Connectivitycomponents, articulation points, bridges, separators
Flowmax-flow, min-cut, Gomory-Hu tree, disjoint paths
IsomorphismVF2, LAD, BLISS canonical labeling
GeneratorsErdos-Renyi, Barabasi-Albert, SBM, lattices, 30+ more
Properties60+ structural recognizers, degree stats, transitivity
LayoutFruchterman-Reingold, Kamada-Kawai, DrL, circle, tree

§Quick start

use rust_igraph::{Graph, bfs};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(1, 3).unwrap();

let order = bfs(&g, 0).unwrap();
assert_eq!(order, vec![0, 1, 2, 3]);

§Import style

All algorithms are re-exported at the crate root for convenience:

use rust_igraph::{Graph, pagerank, betweenness, louvain};

For minimal imports, use the prelude module:

use rust_igraph::prelude::*;

§License

GPL-2.0-or-later, matching upstream igraph.

Re-exports§

pub use crate::algorithms::chordality::ChordalResult;
pub use crate::algorithms::chordality::McsResult;
pub use crate::algorithms::chordality::is_chordal;
pub use crate::algorithms::cliques::clique_number;
pub use crate::algorithms::cliques::clique_size_hist;
pub use crate::algorithms::cliques::cliques;
pub use crate::algorithms::cliques::independence_number;
pub use crate::algorithms::cliques::independent_vertex_sets;
pub use crate::algorithms::cliques::largest_cliques;
pub use crate::algorithms::cliques::largest_independent_vertex_sets;
pub use crate::algorithms::cliques::largest_weighted_cliques;
pub use crate::algorithms::cliques::maximal_cliques;
pub use crate::algorithms::cliques::maximal_cliques_count;
pub use crate::algorithms::cliques::maximal_cliques_hist;
pub use crate::algorithms::cliques::maximal_cliques_subset;
pub use crate::algorithms::cliques::maximal_independent_vertex_sets;
pub use crate::algorithms::cliques::weighted_clique_number;
pub use crate::algorithms::cliques::weighted_cliques;
pub use crate::algorithms::coloring::BipartiteColoringResult;
pub use crate::algorithms::coloring::BipartiteEdgeDirection;
pub use crate::algorithms::coloring::GreedyColoringHeuristic;
pub use crate::algorithms::coloring::chromatic_number_upper_bound;
pub use crate::algorithms::coloring::edge_chromatic_number;
pub use crate::algorithms::coloring::edge_coloring_greedy;
pub use crate::algorithms::coloring::is_bipartite_coloring;
pub use crate::algorithms::coloring::is_edge_coloring;
pub use crate::algorithms::coloring::is_vertex_coloring;
pub use crate::algorithms::coloring::vertex_chromatic_number;
pub use crate::algorithms::coloring::vertex_coloring_greedy;
pub use crate::algorithms::constructors::adjacency::AdjacencyMode;
pub use crate::algorithms::constructors::adjacency::LoopsMode;
pub use crate::algorithms::constructors::adjacency::adjacency;
pub use crate::algorithms::constructors::atlas::ATLAS_SIZE;
pub use crate::algorithms::constructors::atlas::atlas;
pub use crate::algorithms::constructors::biadjacency::BiadjacencyResult;
pub use crate::algorithms::constructors::biadjacency::biadjacency;
pub use crate::algorithms::constructors::circulant::circulant;
pub use crate::algorithms::constructors::create::create;
pub use crate::algorithms::constructors::create_bipartite::create_bipartite;
pub use crate::algorithms::constructors::de_bruijn::de_bruijn;
pub use crate::algorithms::constructors::extended_chordal_ring::extended_chordal_ring;
pub use crate::algorithms::constructors::famous::famous;
pub use crate::algorithms::constructors::famous::famous_names;
pub use crate::algorithms::constructors::full::full_graph;
pub use crate::algorithms::constructors::full_bipartite::FullBipartite;
pub use crate::algorithms::constructors::full_bipartite::full_bipartite;
pub use crate::algorithms::constructors::full_citation::full_citation;
pub use crate::algorithms::constructors::full_multipartite::FullMultipartite;
pub use crate::algorithms::constructors::full_multipartite::MultipartiteMode;
pub use crate::algorithms::constructors::full_multipartite::full_multipartite;
pub use crate::algorithms::constructors::generalized_petersen::generalized_petersen;
pub use crate::algorithms::constructors::hamming::hamming;
pub use crate::algorithms::constructors::hexagonal_lattice::hexagonal_lattice;
pub use crate::algorithms::constructors::hypercube::MAX_HYPERCUBE_DIMENSION;
pub use crate::algorithms::constructors::hypercube::hypercube;
pub use crate::algorithms::constructors::kary_tree::TreeMode;
pub use crate::algorithms::constructors::kary_tree::kary_tree;
pub use crate::algorithms::constructors::kautz::kautz;
pub use crate::algorithms::constructors::lcf::lcf;
pub use crate::algorithms::constructors::linegraph::linegraph;
pub use crate::algorithms::constructors::mycielskian::mycielski_graph;
pub use crate::algorithms::constructors::mycielskian::mycielskian;
pub use crate::algorithms::constructors::prufer::from_prufer;
pub use crate::algorithms::constructors::prufer::to_prufer;
pub use crate::algorithms::constructors::realize_bipartite_degree_sequence::realize_bipartite_degree_sequence;
pub use crate::algorithms::constructors::realize_degree_sequence::RealizeDegseqMethod;
pub use crate::algorithms::constructors::realize_degree_sequence::realize_degree_sequence;
pub use crate::algorithms::constructors::realize_directed_degree_sequence::realize_directed_degree_sequence;
pub use crate::algorithms::constructors::regular_tree::regular_tree;
pub use crate::algorithms::constructors::ring::cycle_graph;
pub use crate::algorithms::constructors::ring::path_graph;
pub use crate::algorithms::constructors::ring::ring_graph;
pub use crate::algorithms::constructors::square_lattice::square_lattice;
pub use crate::algorithms::constructors::star::StarMode;
pub use crate::algorithms::constructors::star::star_graph;
pub use crate::algorithms::constructors::symmetric_tree::symmetric_tree;
pub use crate::algorithms::constructors::tree_from_parent_vector::tree_from_parent_vector;
pub use crate::algorithms::constructors::triangular_lattice::triangular_lattice;
pub use crate::algorithms::constructors::turan::turan;
pub use crate::algorithms::constructors::weighted_adjacency::weighted_adjacency;
pub use crate::algorithms::constructors::weighted_biadjacency::WeightedBiadjacencyResult;
pub use crate::algorithms::constructors::weighted_biadjacency::weighted_biadjacency;
pub use crate::algorithms::constructors::wheel::WheelMode;
pub use crate::algorithms::constructors::wheel::wheel_graph;
pub use crate::algorithms::cycles::CycleMode;
pub use crate::algorithms::cycles::CycleResult;
pub use crate::algorithms::cycles::find_cycle;
pub use crate::algorithms::dominating_set::is_dominating_set;
pub use crate::algorithms::dominating_set::minimum_dominating_set;
pub use crate::algorithms::edge_cover::is_edge_cover;
pub use crate::algorithms::edge_cover::minimum_edge_cover;
pub use crate::algorithms::embedding::adjacency_spectral_embedding::AdjacencySpectralEmbeddingResult;
pub use crate::algorithms::embedding::adjacency_spectral_embedding::SpectralWhich;
pub use crate::algorithms::embedding::adjacency_spectral_embedding::adjacency_spectral_embedding;
pub use crate::algorithms::embedding::dim_select::dim_select;
pub use crate::algorithms::embedding::laplacian_spectral_embedding::LaplacianSpectralEmbeddingResult;
pub use crate::algorithms::embedding::laplacian_spectral_embedding::LaplacianType;
pub use crate::algorithms::embedding::laplacian_spectral_embedding::laplacian_spectral_embedding;
pub use crate::algorithms::epidemics::Sir;
pub use crate::algorithms::epidemics::sir;
pub use crate::algorithms::feedback_arc_set::FasAlgorithm;
pub use crate::algorithms::feedback_arc_set::feedback_arc_set;
pub use crate::algorithms::feedback_vertex_set::FvsAlgorithm;
pub use crate::algorithms::feedback_vertex_set::feedback_vertex_set;
pub use crate::algorithms::fundamental_cycles::fundamental_cycles;
pub use crate::algorithms::games::barabasi::barabasi_game_bag;
pub use crate::algorithms::games::barabasi_aging::barabasi_aging_game;
pub use crate::algorithms::games::barabasi_psumtree::barabasi_game_psumtree;
pub use crate::algorithms::games::barabasi_psumtree::barabasi_game_psumtree_multiple;
pub use crate::algorithms::games::bipartite::BipartiteGraph;
pub use crate::algorithms::games::bipartite::BipartiteMode;
pub use crate::algorithms::games::bipartite::bipartite_game_gnm;
pub use crate::algorithms::games::bipartite::bipartite_game_gnp;
pub use crate::algorithms::games::bipartite::bipartite_iea_game;
pub use crate::algorithms::games::callaway_traits::callaway_traits_game;
pub use crate::algorithms::games::chung_lu::ChungLuVariant;
pub use crate::algorithms::games::chung_lu::chung_lu_game;
pub use crate::algorithms::games::cited_type::cited_type_game;
pub use crate::algorithms::games::citing_cited_type::citing_cited_type_game;
pub use crate::algorithms::games::correlated::correlated_game;
pub use crate::algorithms::games::correlated::correlated_pair_game;
pub use crate::algorithms::games::degree_sequence::degree_sequence_game_configuration;
pub use crate::algorithms::games::degree_sequence_configuration_simple::degree_sequence_game_configuration_simple;
pub use crate::algorithms::games::degree_sequence_fast_heur::degree_sequence_game_fast_heur_simple;
pub use crate::algorithms::games::degree_sequence_vl::degree_sequence_game_vl;
pub use crate::algorithms::games::dotproduct::DotProductWarnings;
pub use crate::algorithms::games::dotproduct::dot_product_game;
pub use crate::algorithms::games::dotproduct::dot_product_game_with_warnings;
pub use crate::algorithms::games::edge_switching_simple::degree_sequence_game_edge_switching_simple;
pub use crate::algorithms::games::erdos_renyi::erdos_renyi_gnm;
pub use crate::algorithms::games::erdos_renyi::erdos_renyi_gnp;
pub use crate::algorithms::games::establishment::establishment_game;
pub use crate::algorithms::games::forestfire::forest_fire_game;
pub use crate::algorithms::games::grg::grg_game;
pub use crate::algorithms::games::grg::grg_game_with_coords;
pub use crate::algorithms::games::growing_random::growing_random_game;
pub use crate::algorithms::games::hsbm::hsbm_game;
pub use crate::algorithms::games::hsbm::hsbm_list_game;
pub use crate::algorithms::games::iea_game::iea_game;
pub use crate::algorithms::games::islands::simple_interconnected_islands_game;
pub use crate::algorithms::games::k_regular::k_regular_game;
pub use crate::algorithms::games::lastcit::lastcit_game;
pub use crate::algorithms::games::preference::asymmetric_preference_game;
pub use crate::algorithms::games::preference::preference_game;
pub use crate::algorithms::games::recent_degree::recent_degree_game;
pub use crate::algorithms::games::recent_degree_aging::recent_degree_aging_game;
pub use crate::algorithms::games::sbm::sbm_game;
pub use crate::algorithms::games::static_fitness::static_fitness_game;
pub use crate::algorithms::games::static_fitness::static_power_law_game;
pub use crate::algorithms::games::tree::tree_game_lerw;
pub use crate::algorithms::games::tree::tree_game_prufer;
pub use crate::algorithms::games::watts::watts_strogatz_game;
pub use crate::algorithms::graphlets::GraphletBasis;
pub use crate::algorithms::graphlets::GraphletDecomposition;
pub use crate::algorithms::graphlets::graphlets;
pub use crate::algorithms::graphlets::graphlets_candidate_basis;
pub use crate::algorithms::graphlets::graphlets_project;
pub use crate::algorithms::independent_set::maximum_independent_set;
pub use crate::algorithms::matching::MatchingResult;
pub use crate::algorithms::matching::is_matching;
pub use crate::algorithms::matching::is_maximal_matching;
pub use crate::algorithms::matching::maximum_bipartite_matching;
pub use crate::algorithms::matching::maximum_bipartite_matching_weighted;
pub use crate::algorithms::matching_lsap::solve_lsap;
pub use crate::algorithms::max_cut::MaxCutResult;
pub use crate::algorithms::max_cut::cut_value;
pub use crate::algorithms::max_cut::maximum_cut;
pub use crate::algorithms::minimum_cycle_basis::minimum_cycle_basis;
pub use crate::algorithms::motifs::DyadCensus;
pub use crate::algorithms::motifs::TriadCensus;
pub use crate::algorithms::motifs::TriadType;
pub use crate::algorithms::motifs::dyad_census;
pub use crate::algorithms::motifs::graph_count;
pub use crate::algorithms::motifs::graph_count;
pub use crate::algorithms::motifs::isoclass;
pub use crate::algorithms::motifs::isoclass;
pub use crate::algorithms::motifs::isoclass_create;
pub use crate::algorithms::motifs::isoclass_subgraph;
pub use crate::algorithms::motifs::motifs_randesu;
pub use crate::algorithms::motifs::motifs_randesu;
pub use crate::algorithms::motifs::motifs_randesu_callback;
pub use crate::algorithms::motifs::motifs_randesu_estimate;
pub use crate::algorithms::motifs::motifs_randesu_no;
pub use crate::algorithms::motifs::triad_census;
pub use crate::algorithms::motifs::triad_census;
pub use crate::algorithms::simple_cycles::SimpleCycle;
pub use crate::algorithms::simple_cycles::SimpleCycleMode;
pub use crate::algorithms::simple_cycles::simple_cycles;
pub use crate::algorithms::vertex_cover::is_vertex_cover;
pub use crate::algorithms::vertex_cover::minimum_vertex_cover;

Modules§

algorithms
Algorithm implementations for rust-igraph.
prelude
Minimal import set for common use cases.

Structs§

AllShortestPaths
Result of get_all_shortest_paths / get_all_shortest_paths_with_mode.
AllShortestPathsDijkstra
Result of get_all_shortest_paths_dijkstra.
BetaWeightedGabriel
A Gabriel graph together with the per-edge β-threshold weights.
BfsSimple
Result of bfs_simple.
BfsTree
Result of a multi-output BFS scan from a single root. Returned by bfs_tree.
BiconnectedComponents
Output of biconnected_components.
BipartiteProjection
Result of a bipartite projection.
BipartiteProjectionSize
Sizes of both bipartite projections.
BipartiteResult
Result of bipartiteness check.
CentralizationResult
Result of a centralization convenience wrapper.
ClosenessCutoffResult
Result of closeness_cutoff.
CohesiveBlocks
Result of cohesive_blocks.
CommunityToMembershipResult
Result of community_to_membership: per-vertex cluster ids densified to 0..k, plus the size of each cluster in the same order.
CommunityVoronoiResult
Result of community_voronoi.
ConnectedComponents
Result of a weak connected-components scan.
ConvexHullResult
Result of convex_hull_2d.
DfsSimple
Result of dfs_simple.
DfsTree
Result of a multi-output DFS scan from a single root. Returned by dfs_tree.
DhParams
Parameters for the Davidson-Harel layout.
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.
DimacsGraph
Result of reading a DIMACS file.
DlGraph
Result of reading a DL file.
DominatorTree
Result of dominator_tree.
DrlOptions
Full DrL options.
EdgeBetweennessResult
Result of edge_betweenness_community.
EdgelistPercolation
Outputs of edgelist_percolation. Same length as the input edge slice. giant_size[i] is the size of the largest component after edge i is added; vertex_count[i] is the number of distinct vertices touched by edges 0..=i.
EigenvectorScores
Output of eigenvector_centrality_full: the normalised centrality vector and the dominant eigenvalue of the (possibly shifted-back) adjacency matrix.
EulerianClassification
Whether an Eulerian path or cycle exists in a graph.
EvenTarjanResult
Result of the Even-Tarjan reduction.
FastGreedyResult
Result of fast_greedy_modularity / fast_greedy_modularity_weighted.
FluidOptions
Full option bag for fluid_communities_with_options.
FluidResult
Result of fluid_communities / fluid_communities_with_options.
FrBounds
Optional per-vertex bounding box constraints.
FrBounds3d
3D bounding box constraints.
FrParams
Parameters for the 2D Fruchterman-Reingold layout.
FrParams3d
Parameters for the 3D Fruchterman-Reingold layout.
GemParams
Parameters for the GEM layout algorithm.
GetBiadjacencyResult
Result of get_biadjacency_matrix.
GetBiadjacencyWeightedResult
Result of get_biadjacency_weighted.
GomoryHuTree
Output of gomory_hu_tree — a weighted undirected tree on the same vertex set as the input graph, plus one flow value per tree edge.
Graph
Counterpart of igraph_t (see references/igraph/include/igraph_datatype.h).
GraphoptParams
Parameters for the GraphOpt layout.
HitsScores
Output of hub_and_authority_scores: scaled hub and authority vectors and the dominant eigenvalue of A·Aᵀ.
InducedSubgraphResult
Result of an induced subgraph extraction.
KShortestPath
Result of k_shortest_paths.
KkBounds
Per-vertex coordinate bounds for the 2D KK layout.
KkBounds3d
Per-vertex coordinate bounds for the 3D KK layout.
KkParams
Parameters for the 2D Kamada-Kawai layout.
KkParams3d
Parameters for the 3D Kamada-Kawai layout.
LadSubisomorphism
Result of a first-solution LAD subgraph-isomorphism search (subisomorphic_lad).
LeadingEigenvectorResult
Result of the leading eigenvector community detection.
LeidenOptions
Full set of options for leiden_with_options. Construct via LeidenOptions::default() and then mutate the fields you care about, mirroring the way upstream C exposes per-parameter defaults.
LeidenResult
Result of a Leiden run.
LglGraph
Result of reading an LGL file: the graph plus optional metadata.
LglParams
Parameters for the LGL layout algorithm.
LouvainResult
Result of a Louvain run.
LpaOptions
Full option bag for label_propagation_with_options.
LpaResult
Result of a label-propagation run.
MaxFlow
Output of max_flow: scalar value, per-edge flow vector, cut edge ids, and source-side / sink-side vertex partitions.
NcolGraph
Result of reading an NCOL file: the graph plus optional metadata.
PajekGraph
Result of reading a Pajek file.
PathLengthHistResult
Result of path_length_hist.
PowerLawFitResult
Result of fitting a power-law distribution to a sample.
PseudoDiameterResult
Result of the pseudo-diameter computation.
ReachabilityResult
Result of a reachability analysis.
ReindexMembershipResult
Result of reindex_membership: a densified membership vector [0, k), the old cluster id behind each new id (so new_to_old[i] is the original id that now maps to i), and the number of distinct clusters k = new_to_old.len().
ResidualGraphResult
Result of the residual graph computation.
ShortestPath
A single shortest path: the vertex sequence (including from and to) and the edge sequence along it. For a path of k vertices the edge vector has k - 1 entries.
ShortestPathsDijkstra
Result of get_shortest_paths_dijkstra: vertex and edge paths from a single source to all vertices.
SimplifyAndColorize
The colored simple graph produced by simplify_and_colorize.
SitePercolation
Outputs of site_percolation. Same length as vertex_order. giant_size[i] is the size of the largest connected component after vertex vertex_order[i] is activated; edge_count[i] is the cumulative number of edges added through step i (an edge is “added” the moment both its endpoints become active).
SplitJoinDistance
Asymmetric split-join distances between two community partitions.
StCuts
Result of all_st_cuts.
StMinCuts
Result of all_st_mincuts.
StMincut
Output of st_mincut: scalar value, cut edge ids, and the source-side / sink-side vertex partitions.
StronglyRegularParams
Result of strongly regular graph recognition.
SubgraphFromEdgesResult
Result of a subgraph-from-edges extraction.
SugiyamaParams
Parameters for the Sugiyama layout.
SugiyamaResult
Result of a Sugiyama layout computation.
UmapParams
Parameters for the UMAP layout algorithm.
UnfoldTreeResult
Result of unfolding a graph into a tree.
Vf2Isomorphism
Result of an exact VF2 graph-isomorphism test (isomorphic_vf2).
Vf2Subisomorphism
Result of a VF2 subgraph-isomorphism test (subisomorphic_vf2).
VoronoiPartition
Result of voronoi: the Voronoi cell each vertex belongs to plus the distance to its assigned generator.
WalktrapOptions
Tuning knobs for walktrap_with_options.
WalktrapResult
Result of walktrap / walktrap_weighted / walktrap_with_options.
WidestPaths
Sidecar outputs from a single-source widest-paths run. Carries the widths vector plus the parent-pointer SPT (vertex-side and edge-side). Counterpart of the parents and inbound_edges outputs of igraph_get_widest_paths. Source itself has parents[source] == None and inbound_edges[source] == None; unreachable vertices also have both None. To disambiguate the source from unreachable targets, consult widths: source has Some(f64::INFINITY), unreachable has None.

Enums§

AdjacencyType
Which triangle of the adjacency matrix to fill (undirected graphs only).
AllShortestPathsMode
Direction mode for get_all_shortest_paths and get_all_shortest_paths_with_mode.
BfsMode
Direction mode for bfs_simple.
CachedProperty
The set of boolean graph properties that may be cached.
CentralizationMode
Whether centralization considers in-degree, out-degree, or total.
CommunityComparison
Which partition-comparison measure compare_communities returns.
ConnectednessMode
Connectivity mode for directed graphs.
CorenessMode
Direction-handling for coreness_with_mode.
DegreeMode
Direction mode for degree computation in directed graphs.
DfsMode
Direction mode for dfs_simple.
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).
DimacsProblem
The type of DIMACS problem read from the file.
DistanceMetric
Distance metric for spatial edge length computation.
DistancesCutoffMode
Direction mode for cutoff-aware unweighted distance functions.
DistancesFromMode
Direction mode for distances_from_with_mode.
DistancesMode
Direction mode for distances_all_with_mode.
DominatorMode
Traversal direction for dominator_tree.
DrlTemplate
Predefined parameter templates for DrL.
EccMode
Mode for direction-aware eccentricity / radius / diameter on directed graphs. For undirected graphs every mode reduces to EccMode::All.
EdgeTypeFilter
What kinds of edges are allowed when testing graphicality.
EigenvectorMode
How to consider edge directions for eigenvector_centrality_full and friends. Mirrors upstream’s IGRAPH_OUT / IGRAPH_IN / IGRAPH_ALL.
FrGrid
Grid acceleration mode for Fruchterman-Reingold layout.
GraphProductType
Selects which graph product type to compute.
IgraphError
All errors returned from rust-igraph.
LaplacianNormalization
Laplacian normalization mode.
LeidenObjective
Quality function (objective) that Leiden optimises. Mirrors igraph_leiden_objective_t.
LoopHandling
How to count self-loop edges in the adjacency matrix diagonal.
LoopMode
How loops are counted when computing degree centralization.
LpaVariant
Which variant of label propagation to run. Mirrors igraph_lpa_variant_t.
MstAlgorithm
Selector for the minimum-spanning-tree algorithm.
NeighborhoodMode
Direction mode for neighborhood_size_with_mode on directed graphs. Ignored on undirected graphs — every mode reduces to NeighborhoodMode::All.
ReachabilityMode
Direction mode for reachability in directed graphs.
ReciprocityMode
Reciprocity formula choice. Counterpart of upstream’s igraph_reciprocity_t (IGRAPH_RECIPROCITY_DEFAULT / IGRAPH_RECIPROCITY_RATIO).
RewireDirectedMode
Which endpoint of a directed edge to rewire.
RootChoice
Heuristic for selecting tree-layout roots when multiple candidates exist within a component.
RtMode
Mode for tree edge traversal direction.
ShortestPathMode
Direction mode for get_shortest_paths_with_mode.
SimpleMode
Direction-handling for is_simple_with_mode. Counterpart of upstream’s directed boolean parameter.
SimplePathMode
Mode for traversing neighbors in directed graphs.
SortOrder
Sort order for vertex degree sorting.
StrengthMode
Direction mode for strength_with_mode on directed graphs. Ignored on undirected graphs.
SubcomponentMode
Direction mode for subcomponent search.
ToDirectedMode
Mode for converting an undirected graph to directed.
ToUndirectedMode
Mode for converting a directed graph to undirected.
TransitivityMode
How to handle vertices with degree < 2 when averaging local transitivity.
VconnNei
Behaviour when source and target are directly adjacent.
VoronoiTiebreaker
Tie-breaking rule used when two or more generators reach a vertex at the same distance.
WalkMode
Direction mode for edge-path traversal.

Constants§

FLUID_DEFAULT_MAX_ITERATIONS
Default safety cap on outer iterations for fluid_communities / fluid_communities_with_options.
LEIDEN_DEFAULT_BETA
Default randomness used in the refinement step — same default as upstream igraph_community_leiden_simple (β = 0.01).
LEIDEN_DEFAULT_ITERATIONS
Default number of outer iterations. The reference paper and upstream both note that two iterations are usually enough.
WALKTRAP_DEFAULT_STEPS
Default random-walk length matching the igraph reference (steps = 4).

Functions§

a_star_path
Single-source single-target shortest path using A*.
adhesion
Group adhesion — igraph C alias igraph_adhesion (flow.c:2433). Exact synonym for edge_connectivity; kept for naming parity with the upstream API and so users following the White-Harary (2001) sociological-network literature have a direct hit. Identical signature and behaviour.
all_minimal_st_separators
List all vertex sets that are minimal (s,t) separators for some s and t.
all_simple_paths
Enumerate all simple paths from from to vertices in to.
all_st_cuts
List all (s,t) edge cuts of a directed graph (Provan-Shier).
all_st_mincuts
List all minimum (s,t) edge cuts of a directed graph (Provan-Shier).
are_adjacent
Check whether two vertices are connected by at least one edge.
articulation_points
Articulation points of graph (returns vertices in upstream’s DFS-discovery order).
assortativity
Value-based assortativity coefficient of graph.
assortativity_degree
Degree assortativity coefficient of graph (undirected, unweighted). Returns None for graphs with no edges or for regular graphs (all vertices same degree — the variance denominator vanishes, matching upstream’s IGRAPH_NAN).
assortativity_degree_directed
Directed degree assortativity coefficient (ALGO-PR-006c).
assortativity_degree_directed_weighted
Directed weighted degree assortativity (PR-006d).
assortativity_degree_weighted
Weighted degree assortativity coefficient.
assortativity_nominal
Compute categorical (nominal) assortativity coefficient.
automorphism_group
Compute a generating set of the automorphism group Aut(G).
average_local_efficiency
Average of local_efficiency over all N vertices. By upstream convention, returns 0.0 when vcount < 3 (no vertex can have two distinct neighbours, so every per-vertex value is trivially 0).
avg_nearest_neighbor_degree
Average nearest-neighbour degree, per vertex.
avg_nearest_neighbor_degree_weighted
Weighted average nearest-neighbour degree (Barrat formula).
bellman_ford_distances
Single-source Bellman-Ford shortest distances on graph from source, following out-edges on directed graphs.
bellman_ford_distances_with_mode
Single-source Bellman-Ford with directed-mode selection.
bellman_ford_path_to
Returns the shortest path from source to target using Bellman-Ford, following out-edges on directed graphs.
bellman_ford_path_to_with_mode
Returns the shortest path from source to target using Bellman-Ford with directed-mode selection.
bellman_ford_paths
Shortest paths from source to each vertex in targets using Bellman-Ford (handles negative edge weights).
bellman_ford_paths_with_mode
Multi-target Bellman-Ford shortest paths with directed-mode selection.
beta_weighted_gabriel_graph
Build the β-weighted Gabriel graph of a point set.
betweenness
Per-vertex (unweighted) betweenness centrality.
betweenness_cutoff
Range-limited betweenness centrality.
betweenness_subset
Subset betweenness centrality.
betweenness_weighted
Per-vertex weighted betweenness centrality.
bfs
Visit order of vertices reachable from root, in BFS order.
bfs_simple
Mode-aware BFS from a single root, returning visit order, layer boundaries, and BFS-tree parents.
bfs_tree
Multi-output BFS from root. Returns visit order, per-vertex distances, and per-vertex BFS-tree parent in a single pass.
bibcoupling
Computes bibliographic coupling scores between all pairs of vertices.
biconnected_components
Compute the biconnected components of graph.
bipartite_projection
Project a bipartite graph onto one of its vertex types.
bipartite_projection_size
Compute sizes of both bipartite projections without building them.
bond_percolation
Bond percolation: the size of the largest component as edges of graph are added in the order specified by edge_order.
bridges
Bridges of graph — edges whose removal would increase the number of (weakly) connected components.
canonical_permutation
Compute a canonical vertex permutation of graph.
cartesian_product
Computes the Cartesian product of two graphs.
centralization
Compute the graph-level centralization score from per-vertex scores.
centralization_betweenness_tmax
Theoretical maximum betweenness centralization for a star graph.
centralization_betweenness_wrapper
Betweenness centralization: compute per-vertex betweenness scores and the graph-level centralization in one call.
centralization_closeness_tmax
Theoretical maximum closeness centralization for a star graph.
centralization_closeness_wrapper
Closeness centralization: compute per-vertex closeness scores and the graph-level centralization in one call.
centralization_degree_tmax
Theoretical maximum degree centralization for a star graph.
centralization_degree_wrapper
Degree centralization: compute per-vertex degree scores and the graph-level centralization in one call.
centralization_eigenvector_tmax
Theoretical maximum eigenvector centralization for a star graph.
centralization_eigenvector_wrapper
Eigenvector centralization: compute per-vertex eigenvector centrality scores and the graph-level centralization in one call.
circle_beta_skeleton
Build the circle-based β-skeleton of a 2-D point set.
closeness
Per-vertex closeness centrality (Vec<Option<f64>>).
closeness_cutoff
Range-limited closeness centrality.
closeness_weighted
Per-vertex weighted closeness centrality.
cocitation
Computes the cocitation scores between all pairs of vertices.
cohesion
Group cohesion — igraph C alias igraph_cohesion (flow.c:2470). Exact synonym for vertex_connectivity; kept for naming parity with the upstream API and so users following the White-Harary (2001) sociological-network literature have a direct hit. Identical signature and behaviour.
cohesive_blocks
Identify the hierarchical cohesive block structure of a graph.
community_to_membership
Cut a binary dendrogram at steps merges, returning the resulting membership and cluster-size vectors.
community_voronoi
compare_communities
Compare two community membership vectors over the same vertex set.
complementer
Returns the complementer of graph.
compose
Computes the composition of two graphs.
connect_neighborhood
Returns a new graph where each vertex is connected to all vertices reachable within order steps in the original graph.
connected_components
Compute the weak connected components of graph.
constraint
Compute Burt’s constraint scores for all vertices.
contract_vertices
Contracts vertices according to a grouping, merging edges.
convergence_degree
Per-edge convergence degree.
convergence_degree_full
Convergence degree along with the per-edge In(e) / Out(e) counts.
convex_hull_2d
Compute the convex hull of a set of 2D points.
coreness
Per-vertex coreness number.
coreness_with_mode
Coreness with explicit CorenessMode (ALGO-PR-015b).
count_adjacent_triangles
Per-vertex adjacent-triangle count. Entry i is the number of triangles vertex i participates in. Parallel edges and self-loops are ignored — the simple graph induced by the OUT-neighbour view is used (consistent with count_triangles). For directed graphs that is not yet the underlying-undirected projection that upstream uses; see ALGO-PR-002 for the deferred fix.
count_automorphisms
Count the automorphisms of graph — the order |Aut(G)| of its automorphism group.
count_isomorphisms_vf2
Count the number of VF2 isomorphic mappings between two graphs.
count_loops
Counts self-loop edges in graph.
count_multiple
Per-edge multiplicity: how many edges share each edge’s endpoint pair.
count_multiple_1
Multiplicity of a single edge: how many edges share the same endpoint pair as edge eid.
count_mutual
Count the number of mutual edge pairs in a directed graph.
count_reachable
Per-vertex count of reachable vertices (including the vertex itself).
count_subisomorphisms_vf2
Count the number of VF2 subgraph-isomorphic embeddings of the pattern graph2 into the target graph1.
count_triangles
Count the number of triangles in graph. Edge directions, parallel edges, and self-loops are ignored.
decompose
Decompose graph into its weakly connected components.
degeneracy
Return the degeneracy of a graph.
degree_correlation_vector
Compute the degree correlation function k_nn(k).
degree_distribution
Compute the degree distribution histogram of a graph.
degree_sequence
Returns the degree sequence of the graph.
delaunay_graph
Build the Delaunay triangulation graph of a 1D or 2D point set.
density
Edge density of graph. Counterpart of igraph_density(_, NULL_weights, _, /*loops=*/false).
dfs
Pre-order visit of vertices reachable from root, in DFS order.
dfs_simple
Mode-aware DFS from a single root, returning pre/post-order, parents, and DFS-tree depth.
dfs_tree
Multi-output DFS from root. Returns visit order (pre and post), per-vertex parents, and DFS-tree depth in a single pass.
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.
diameter_with_mode
Diameter of graph under the given mode. None for vcount == 0.
difference
Returns orig \ sub: the multiset difference of the edges.
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).
disjoint_union
Returns the disjoint union of left and right.
disjoint_union_many
Disjoint union of any number of graphs (ALGO-OP-002b).
distances
Unweighted shortest-path lengths from source to 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 source to every vertex, ignoring paths longer than cutoff.
distances_cutoff_multi
Multi-source unweighted distances with cutoff, direction-aware.
distances_cutoff_with_mode
Mode-aware distances_cutoff. For undirected graphs mode is 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.
diversity
Structural diversity index for all vertices in an undirected graph.
dominator_tree
Compute the Lengauer-Tarjan dominator tree of a directed flowgraph.
ecc
Compute the edge clustering coefficient for eids in graph.
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.
eccentricity_with_mode
Eccentricity of every vertex following mode-direction edges.
edge_betweenness
Per-edge unweighted betweenness centrality.
edge_betweenness_community
Run edge-betweenness community detection on graph.
edge_betweenness_community_weighted
Run weighted edge-betweenness community detection on graph with per-edge weights.
edge_betweenness_cutoff
Range-limited edge betweenness centrality.
edge_betweenness_subset
Subset edge betweenness centrality.
edge_betweenness_weighted
Per-edge weighted betweenness centrality (Vec<f64>).
edge_connectivity
Edge connectivity (adhesion) of a graph.
edge_disjoint_paths
Maximum number of pairwise edge-disjoint paths from source to target.
edgelist_percolation
Percolation curve as a sequence of vertex-pair edges is added.
eigenvector_centrality
Backward-compatible undirected, unweighted entry point.
eigenvector_centrality_directed
Directed unweighted eigenvector centrality.
eigenvector_centrality_directed_weighted
Directed weighted eigenvector centrality.
eigenvector_centrality_full
Master entry point matching upstream’s signature.
eigenvector_centrality_weighted
Undirected weighted eigenvector centrality.
eulerian_cycle
Build an Eulerian cycle if one exists, or return an error.
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.
even_tarjan_reduction
Compute the Even-Tarjan reduction of a graph.
expand_path_to_pairs
Expand a vertex path into consecutive pairs for edge lookup.
fast_greedy_modularity
Run fast greedy modularity community detection on graph (unweighted).
fast_greedy_modularity_weighted
Run fast greedy modularity community detection on graph with edge weights.
floyd_warshall_distances
All-pairs shortest distances via Floyd-Warshall.
fluid_communities
Run Fluid Communities with default options (seed = 0, max_iterations = FLUID_DEFAULT_MAX_ITERATIONS).
fluid_communities_with_options
Run Fluid Communities with full option control.
gabriel_graph
Build the Gabriel graph of a point set.
get_adjacency
Compute the adjacency matrix of a graph.
get_all_shortest_paths
Find all shortest paths from source to every reachable vertex.
get_all_shortest_paths_dijkstra
Find all shortest paths from source to every reachable vertex using Dijkstra’s algorithm with non-negative edge weights.
get_all_shortest_paths_dijkstra_with_mode
Find all shortest paths from source with direction control.
get_all_shortest_paths_with_mode
Find all shortest paths from source with direction control.
get_biadjacency_matrix
Extract the biadjacency matrix from a bipartite graph.
get_biadjacency_weighted
Extract a weighted biadjacency matrix from a bipartite graph.
get_edgelist
Return all edges of the graph as a list of (source, target) pairs.
get_eids
Look up edge IDs for a batch of vertex pairs.
get_isomorphisms_vf2
Collect every VF2 isomorphic mapping between two graphs.
get_laplacian
Compute the Laplacian matrix of a graph.
get_shortest_path
Calculate a single shortest path from from to to.
get_shortest_path_astar
Calculate a single shortest path from from to to using A*.
get_shortest_paths
Returns one shortest path from source to every vertex in the graph.
get_shortest_paths_dijkstra
Returns one shortest path from source to 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 source to every vertex, with direction control for directed graphs.
get_stochastic
Compute the stochastic adjacency matrix of a graph.
get_subisomorphisms_lad
Enumerate all subgraph isomorphisms from pattern into target with the LAD algorithm. Each returned vector maps pattern vertex i (by index) to its target vertex.
get_subisomorphisms_vf2
Collect every VF2 subgraph-isomorphic embedding of the pattern graph2 into the target graph1.
girth
Shortest cycle length in graph. Returns None for acyclic graphs.
global_efficiency
Global efficiency of graph — average inverse pairwise shortest distance over all N*(N-1) ordered vertex pairs. Pairs that are unreachable contribute 0.
gomory_hu_tree
Gomory-Hu cut tree of an undirected graph (Gusfield 1990).
graph_center
Return the central vertices of a graph — those with minimum eccentricity.
graph_power
Returns the k-th power of a graph as a simple graph.
graph_product
Computes a graph product selected by product_type.
harmonic_centrality
Per-vertex harmonic centrality.
harmonic_centrality_cutoff
Range-limited harmonic centrality.
harmonic_centrality_weighted
Per-vertex weighted harmonic centrality.
has_loop
Returns true iff graph has at least one self-loop edge.
has_multiple
Returns true iff graph has at least one parallel edge.
has_mutual
Check whether a directed graph has any mutual (reciprocal) edges.
hub_and_authority_scores
Compute Kleinberg’s hub and authority scores.
hub_and_authority_scores_weighted
Weighted Kleinberg hub and authority scores.
induced_subgraph
Creates the subgraph induced by the specified vertices.
induced_subgraph_edges
Returns the IDs of edges whose both endpoints lie in vids.
intersection
Returns the intersection of left and right.
intersection_many
Returns the intersection of multiple graphs.
invert_permutation
Invert a permutation vector.
is_acyclic
Returns true iff graph contains no cycle.
is_apex_forest
Check whether a graph is an apex forest.
is_apex_tree
Check whether a graph is an apex tree.
is_banner_free
Check whether a graph is banner-free (no induced banner / flag).
is_biclique
Check whether a graph is a complete bipartite graph (biclique).
is_biconnected
Check whether graph is biconnected.
is_bigraphical
Test whether a bi-degree-sequence is bigraphical (realizable as a bipartite graph).
is_bipartite
Check whether a graph is bipartite and optionally return the partition.
is_biregular
Check whether a graph is biregular.
is_block_graph
Check whether a graph is a block graph.
is_bowtie_free
Check whether a graph is bowtie-free (no induced bowtie / butterfly).
is_bull_free
Check whether a graph is bull-free.
is_c4_free
Check whether a graph is C_4-free (no induced 4-cycle).
is_c5_free
Check whether a graph is C_5-free (no induced 5-cycle).
is_cactus_graph
Check whether a graph is a cactus graph.
is_caterpillar
Check whether a graph is a caterpillar tree.
is_chain_graph
Check whether a graph is a chain graph.
is_chordal_bipartite
Check whether a graph is chordal bipartite.
is_claw_free
Check whether a graph is claw-free.
is_clique
Check whether a set of vertices forms a clique.
is_cluster_graph
Check whether a graph is a cluster graph (disjoint union of cliques).
is_co_bipartite
Check whether a graph is co-bipartite.
is_co_chordal
Check whether a graph is co-chordal (complement is chordal).
is_cograph
Check whether a graph is a cograph (P4-free).
is_complete
Returns true iff every pair of distinct vertices is adjacent.
is_complete_bipartite
Check whether a graph is complete bipartite.
is_complete_multipartite
Check whether a graph is a complete multipartite graph.
is_connected
Tests whether the graph is connected.
is_cricket_free
Check whether a graph is cricket-free.
is_cubic
Check whether a graph is cubic (3-regular).
is_cycle
Check whether a graph is a cycle graph.
is_dag
Returns true iff graph is a directed acyclic graph.
is_dart_free
Check whether a graph is dart-free (no induced dart).
is_diamond_free
Check whether a graph is diamond-free.
is_distance_hereditary
Check whether a graph is distance-hereditary.
is_eulerian
Decide whether graph has an Eulerian path and/or cycle.
is_forest
Returns Some(roots) iff graph is a forest under mode, otherwise None. The null graph is a forest with empty roots.
is_fork_free
Check whether a graph is fork-free (no induced fork / cross).
is_gem_free
Check whether a graph is gem-free.
is_geodetic
Check whether a graph is geodetic.
is_graphical
Test whether a degree sequence is graphical (realizable as some graph).
is_house_free
Check whether a graph is house-free (no induced house graph).
is_independent_vertex_set
Check whether a set of vertices forms an independent set.
is_k_degenerate
Check whether a graph is k-degenerate.
is_lobster
Check whether a graph is a lobster tree.
is_loop
Returns a per-edge boolean vector marking self-loops.
is_minimal_separator
Check whether a set of vertices is a minimal separator.
is_multiple
Returns a per-edge boolean vector marking multiple (parallel) edges.
is_mutual
Check whether each edge in a directed graph is mutual (reciprocated).
is_net_free
Check whether a graph is net-free (no induced net subgraph).
is_outerplanar
Check whether a graph is outerplanar.
is_p5_free
Check whether a graph is P_5-free (no induced path on 5 vertices).
is_path
Check whether a graph is a path graph.
is_paw_free
Check whether a graph is paw-free.
is_perfect
Returns true when graph is a perfect graph.
is_proper_interval
Check whether a graph is a proper interval graph.
is_pseudo_forest
Check whether a graph is a pseudo-forest.
is_ptolemaic
Check whether a graph is ptolemaic.
is_regular
Check whether a graph is regular.
is_same_graph
Returns true iff g1 and g2 are identical as labelled graphs: same vertex count, same directedness, same edge multiset. Edges differing only in storage order (or, for undirected, in endpoint orientation) are treated as identical.
is_self_complementary
Check whether a graph is self-complementary.
is_semicomplete
Check whether a directed graph is semicomplete.
is_separator
Check whether a set of vertices is a separator of the graph.
is_series_parallel
Check whether a graph is series-parallel.
is_simple
Returns true if graph has neither self-loops nor parallel edges.
is_simple_with_mode
is_simple with explicit SimpleMode (ALGO-PR-013b).
is_spider
Check whether a graph is a spider graph.
is_split_graph
Check whether a graph is a split graph.
is_star
Check whether a graph is a star graph.
is_strongly_chordal
Check whether a graph is strongly chordal.
is_strongly_regular
Check whether a graph is strongly regular.
is_threshold_graph
Check whether a graph is a threshold graph.
is_tournament
Check whether a graph is a tournament.
is_tree
Returns Some(root) iff graph is a tree under mode, otherwise None. The null graph (vcount == 0) is not a tree by convention.
is_triangle_free
Test whether a graph is triangle-free.
is_trivially_perfect
Check whether a graph is trivially perfect.
is_unicyclic
Check whether a graph is unicyclic.
is_weakly_chordal
Check whether a graph is weakly chordal.
is_well_covered
Check whether a graph is well-covered.
is_wheel
Check whether a graph is a wheel graph.
is_windmill
Check whether a graph is a windmill graph.
isomorphic
Decide whether two graphs are isomorphic, choosing a backend automatically.
isomorphic_bliss
Test whether two graphs are isomorphic via canonical labeling (BLISS).
isomorphic_vf2
Test whether two graphs are isomorphic using the VF2 algorithm.
johnson_distances
All-pairs shortest-path distances via Johnson’s algorithm.
join
Creates the join of two graphs.
joint_degree_distribution
Compute the joint degree distribution matrix.
joint_degree_matrix
Compute the joint degree matrix of a graph.
joint_type_distribution
Compute the joint type distribution (mixing matrix).
k_shortest_paths
Finds the k shortest loopless paths between source and target.
knnk
Per-degree average nearest-neighbour degree, k_nn(k).
knnk_weighted
Per-degree weighted average nearest-neighbour degree.
label_propagation
Run label propagation with the default options (LpaVariant::Fast, no initial labels, no fixed vertices, seed 0).
label_propagation_weighted
Run label propagation with per-edge weights (default variant, no initial labels, no fixed vertices, seed 0).
label_propagation_with_options
Run label propagation with the full option bag.
layout_align
Align a graph layout with the coordinate axes.
layout_bipartite
Compute a bipartite layout.
layout_circle
Place vertices uniformly on a unit circle.
layout_davidson_harel
Compute the Davidson-Harel simulated annealing layout.
layout_drl
Compute the DrL layout.
layout_drl_3d
Compute the DrL layout in 3D.
layout_fruchterman_reingold
2D Fruchterman-Reingold force-directed layout.
layout_fruchterman_reingold_3d
3D Fruchterman-Reingold force-directed layout.
layout_gem
Compute the GEM force-directed layout.
layout_graphopt
Compute the GraphOpt force-directed layout.
layout_grid
Place vertices on a regular 2D grid.
layout_grid_3d
Place vertices on a regular 3D grid.
layout_kamada_kawai
Compute 2D Kamada-Kawai layout.
layout_kamada_kawai_3d
Compute 3D Kamada-Kawai layout.
layout_lgl
Compute the Large Graph Layout (LGL).
layout_mds
Compute the MDS (Multidimensional Scaling) layout.
layout_merge_dla
Merge multiple 2D layouts into a single combined layout using DLA placement.
layout_random
Place vertices uniformly at random in the square [-1, 1] × [-1, 1].
layout_random_3d
Place vertices uniformly at random in the cube [-1, 1]³.
layout_reingold_tilford
Compute the Reingold-Tilford tree layout.
layout_reingold_tilford_circular
Circular variant of the Reingold-Tilford layout.
layout_sphere
Place vertices approximately uniformly on a unit sphere.
layout_star
Place vertices in a star layout: center at origin, rest on a unit circle.
layout_sugiyama
Compute the Sugiyama hierarchical layout.
layout_umap
Compute the 2D UMAP layout.
layout_umap_3d
Compute the 3D UMAP layout.
le_community_to_membership
Cut an incomplete dendrogram after steps merges, starting from an initial (non-singleton) cluster assignment.
leading_eigenvector
Detect communities using Newman’s leading eigenvector method.
leading_eigenvector_weighted
Weighted leading eigenvector community detection (convenience wrapper).
leiden
Run Leiden with the default modularity objective, γ = 1, β = 0.01, two iterations, seed 0.
leiden_weighted
Run Leiden with per-edge weights (modularity objective, γ = 1, β = 0.01, two iterations, seed 0).
leiden_with_options
Run Leiden with the full set of options.
lexicographic_product
Computes the lexicographic product of two graphs.
list_triangles
List all triangles in a graph.
local_efficiency
Per-vertex local efficiency. For each vertex v, computes the average inverse distance between every ordered pair of distinct vertices in N(v) (the unique non-self neighbours of v), measured in the subgraph obtained by removing v — paths must not pass through v. Pairs unreachable in G \ {v} contribute 0.
local_scan_0
Local scan-0: vertex degree (unweighted) or strength (weighted).
local_scan_0_them
Local scan-0 on two graphs: degree/strength from them restricted to edges that also exist in us.
local_scan_1
For each vertex, count edges within its closed 1-neighborhood.
local_scan_1_ecount
Local scan-1 edge count / weight sum in the 1-neighbourhood of every vertex, with directed-mode support.
local_scan_1_ecount_them
Local scan-1 edge count on two graphs: count edges from them in the 1-neighbourhood defined by us.
local_scan_k
For each vertex, count edges within its closed k-neighborhood.
local_scan_k_ecount
Mode-aware local scan-k edge count / weight sum.
local_scan_k_ecount_them
Mode-aware local scan-k on two graphs.
local_scan_subset_ecount
Local scan on given vertex subsets: count edges (or sum weights) in the induced subgraph of each subset.
louvain
Run Louvain with the default options (γ = 1, unweighted, deterministic seed 0).
louvain_weighted
Run Louvain with per-edge weights (γ = 1, deterministic seed 0).
louvain_with_options
Run Louvain with the full set of options.
lune_beta_skeleton
Build the lune-based β-skeleton of a point set.
max_degree
Returns the maximum degree in the graph.
max_degree_vertex
Returns the vertex (or one of the vertices) with the maximum degree.
max_flow
Full maximum-flow computation: value, per-edge flow, cut edges, and source-side / sink-side vertex partitions.
max_flow_value
Scalar maximum-flow value from source to target.
mean_degree
Mean degree of the graph.
mean_distance
Mean unweighted shortest-path length over all reachable ordered pairs. Counterpart of igraph_average_path_length(_, NULL_weights, _, _, /*directed=*/true, /*unconn=*/true).
mean_distance_weighted
Compute the weighted mean distance (average shortest path length).
min_degree
Returns the minimum degree in the graph.
mincut
Compute the global minimum cut of a (possibly weighted) graph.
mincut_value
Global minimum-cut value of a (possibly weighted) graph.
minimum_size_separators
Find all minimum-size separating vertex sets.
minimum_spanning_tree
Computes a minimum spanning tree (or forest, if disconnected) of graph and returns the IDs of the edges that constitute the tree.
modular_product
Computes the modular product of two graphs.
modularity
Modularity of graph with respect to community assignment membership.
modularity_directed
Directed modularity (Leicht-Newman, ALGO-CO-001b).
modularity_matrix
Compute the modularity matrix B of a graph.
modularity_weighted
Weighted modularity (ALGO-CO-001c).
modularity_weighted_directed
Directed weighted modularity (Leicht-Newman, ALGO-CO-006c follow-up).
nearest_neighbor_graph
Build the k-nearest-neighbor graph of a point set.
neighborhood
k-hop neighbourhood vertex list for every vertex (mode = All, mindist = 0).
neighborhood_graphs
Per-vertex induced subgraphs of k-hop neighbourhoods (mode = All, mindist = 0).
neighborhood_graphs_with_mode
Per-vertex induced subgraphs of k-hop neighbourhoods with full mode control.
neighborhood_size
k-hop neighbourhood size for every vertex (mode = All, mindist = 0).
neighborhood_size_with_mode
Full mode-aware k-hop neighbourhood size with mindist filter.
neighborhood_with_mode
Full mode-aware k-hop neighbourhood vertex list with mindist filter.
pagerank
PageRank scores via power iteration with damping 0.85.
pagerank_linsys
PageRank via GMRES on (I - α · Mᵀ) · pr = (1 - α)/N · 1.
pagerank_weighted
Weighted PageRank scores via power iteration with damping 0.85.
path_length_hist
Compute a histogram of all shortest-path lengths.
permute_vertices
Creates a new graph with vertices permuted according to the given mapping.
personalized_pagerank
Personalized PageRank scores via power iteration.
personalized_pagerank_default
Personalized PageRank with default damping factor (0.85).
personalized_pagerank_vs
Personalized PageRank with a vertex-set reset distribution.
power_law_fit
Fit a power-law distribution to a sample of numbers.
pseudo_diameter
Approximate the diameter of a graph using pseudo-peripheral vertex search.
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.
radius_with_mode
Radius of graph under the given mode. None for vcount == 0.
random_sample
Generate an increasing random sequence of integers from [l, h].
random_spanning_tree
Uniformly sample a random spanning tree (or forest) of a graph.
random_walk
Random walk on graph starting at start, taking up to steps transitions.
reachability
Compute per-component reachability bitsets.
reachability_matrix
Dense reachability matrix of graph. result[i][j] is true iff vertex j is reachable from i in zero or more steps.
read_dimacs
Read a graph from DIMACS flow/edge format.
read_dl
Read a graph from UCINET DL format.
read_edgelist
Read an edge list from any Read into a fresh Graph.
read_gml
Read a graph from GML format.
read_graphdb
Read a graph from GraphDB binary format.
read_lgl
Read a graph from LGL (.lgl) format.
read_ncol
Read a graph from NCOL (.ncol) format.
read_pajek
Read a graph from Pajek (.net) format.
reciprocity
Reciprocity of graph. Returns None for graphs with no edges (matches upstream’s IGRAPH_NAN).
reciprocity_with_mode
Reciprocity with explicit mode + ignore_loops (ALGO-PR-004b).
regularity
Return the regularity degree of the graph, or None if the graph is not regular.
reindex_membership
Relabel a membership vector so cluster ids run contiguously over 0..k, where k is the number of distinct clusters. The partition is unchanged: two vertices share a cluster in the output iff they shared one in the input. New ids are assigned in first-occurrence order — the first cluster id you encounter when sweeping left to right becomes 0, the next new one becomes 1, and so on.
relative_neighborhood_graph
Build the relative neighborhood graph of a point set.
residual_graph
Compute the residual graph given capacity and flow vectors.
reverse
Returns a new graph with all edge directions reversed.
reverse_edges
Returns a new graph with only the specified edges reversed.
reverse_residual_graph
Compute the reverse-residual graph given capacity and flow vectors.
rewire
Randomly rewires a graph while preserving its degree sequence.
rewire_directed_edges
Rewires one endpoint of directed edges with constant probability.
rewire_edges
Rewires graph edges with constant probability.
rich_club_sequence
Per-vertex rich-club coefficient sequence for graph.
rooted_product
Computes the rooted product of two graphs.
roots_for_tree_layout
Choose “nice” roots for a tree layout.
running_mean
Compute the running mean of a data vector.
sample_dirichlet
Sample points from a Dirichlet distribution.
sample_sphere_surface
Sample points uniformly from the surface of a sphere.
sample_sphere_volume
Sample points uniformly from the volume of a sphere.
satisfies_dirac
Check whether a graph satisfies Dirac’s condition.
satisfies_ore
Check whether a graph satisfies Ore’s condition.
similarity_dice
Compute the full Dice similarity matrix for all vertex pairs.
similarity_dice_es
Computes Dice similarity coefficients for pairs of vertices connected by the given edges.
similarity_dice_pairs
Computes Dice similarity coefficients for given vertex pairs.
similarity_inverse_log_weighted
Compute the full inverse-log-weighted (Adamic-Adar) similarity matrix.
similarity_inverse_log_weighted_pairs
Computes the inverse log-weighted (Adamic-Adar) similarity for given vertex pairs.
similarity_jaccard
Compute the full Jaccard similarity matrix for all vertex pairs.
similarity_jaccard_es
Computes Jaccard similarity coefficients for pairs of vertices connected by the given edges.
similarity_jaccard_pairs
Computes Jaccard similarity coefficients for given vertex pairs.
simplify
Return a copy of graph with self-loops and/or parallel edges removed.
simplify_and_colorize
Build a vertex- and edge-colored simple graph from graph.
site_percolation
Site percolation: the size of the largest component as vertices (sites) of graph are activated in the order specified by vertex_order.
sort_vertices_by_degree
Return vertex IDs sorted by their degree.
spanner
Compute a t-spanner of the graph.
spatial_edge_lengths
Compute edge lengths from spatial vertex coordinates.
split_join_distance
Compute the two asymmetric projection distances between comm1 and comm2.
st_edge_connectivity
Edge connectivity between two vertices: the minimum number of edges whose removal disconnects source from target.
st_mincut
Full s-t minimum-cut: scalar value, the cut edge list, and the source-side / sink-side vertex partitions.
st_mincut_value
Scalar s-t minimum-cut value (capacity of the minimum edge set whose removal disconnects source from target).
st_vertex_connectivity
Vertex connectivity between two vertices.
strength
Weighted vertex degree for all vertices.
strength_with_mode
Weighted vertex degree with direction mode and loop control.
strong_product
Computes the strong product of two graphs.
strongly_connected_components
Compute the strongly connected components of graph.
subcomponent
Returns all vertices reachable from source following edges in the specified mode.
subgraph_from_edges
Create a subgraph containing only the specified edges.
subisomorphic
Decide whether graph2 is isomorphic to a subgraph of graph1.
subisomorphic_lad
Decide whether pattern is isomorphic to a subgraph of target using the LAD algorithm, returning the first embedding found.
subisomorphic_vf2
Test whether the pattern graph2 is a (non-induced) subgraph of the target graph1, using the VF2 algorithm.
tensor_product
Computes the tensor (categorical/direct) product of two graphs.
to_directed
Converts an undirected graph to a directed graph.
to_undirected
Converts a directed graph to an undirected graph.
topological_sorting
Returns a topological ordering of graph’s vertices.
transitive_closure
Transitive closure of graph. The returned graph shares the same vertex count and direction as the input.
transitivity_avglocal_undirected
Average local transitivity (clustering coefficient).
transitivity_barrat
Barrat’s weighted local transitivity, per vertex.
transitivity_local_undirected
Local transitivity (clustering coefficient) per vertex.
transitivity_undirected
Global transitivity (clustering coefficient) of graph3 * triangles / connected_triples. Returns None when there are no connected triples (matches upstream’s IGRAPH_TRANSITIVITY_NAN mode); use .unwrap_or(0.0) for the IGRAPH_TRANSITIVITY_ZERO behaviour.
trussness
Compute the trussness of every edge in an undirected graph.
umap_compute_weights
Compute UMAP weights from edge distances.
unfold_tree
Unfold a graph into a tree by BFS, replicating multiply-visited vertices.
union
Returns the union of left and right.
union_many
Returns the union of multiple graphs.
vertex_connectivity
Vertex connectivity (cohesion) of a graph.
vertex_disjoint_paths
Maximum number of pairwise internally vertex-disjoint paths from source to target.
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.
walktrap
Run Walktrap on an unweighted, undirected graph with default steps = 4.
walktrap_weighted
Run Walktrap on a weighted, undirected graph with default steps = 4.
walktrap_with_options
Run Walktrap with a custom WalktrapOptions.
widest_path
Widest path from from to to: returns the vertex sequence and the edge sequence along the widest (maximum-bottleneck) path.
widest_path_widths
Single-source widest-path widths on graph from source, following out-edges on directed graphs.
widest_path_widths_floyd_warshall
All-pairs widest-path widths via the Floyd-Warshall recurrence.
widest_path_widths_floyd_warshall_with_mode
Mode-aware variant of widest_path_widths_floyd_warshall. Mode selects how directed edges contribute to the adjacency matrix:
widest_path_widths_with_mode
Widest-path widths with directed-mode selection. Mirrors widest_path_widths but lets you choose OUT/IN/ALL traversal for directed graphs (ignored on undirected).
widest_path_with_mode
Widest path with mode selection. Mirrors widest_path but lets you pick OUT/IN/ALL traversal on directed graphs.
widest_paths
Single-source widest-paths sidecar: widths plus the parent-pointer SPT. Convenient when you want all of widths, parent vertices, and inbound edge ids in one call without re-running the SPT.
widest_paths_to
Widest paths from a single source to multiple targets. Returns one WidestPathResult per element of targets, in the same order; None means the target is unreachable from from.
widest_paths_to_with_mode
Mode-aware variant of widest_paths_to.
widest_paths_with_mode
Mode-aware variant of widest_paths.
write_dimacs_flow
Write a graph in DIMACS max-flow format.
write_dot
Write a graph in DOT (Graphviz) format.
write_edgelist
Write a graph as an edge list.
write_gml
Write a graph in GML format.
write_graphml
Write a graph in GraphML format.
write_leda
Write a graph in LEDA native graph format.
write_lgl
Write a graph in LGL format.
write_ncol
Write a graph in NCOL format.
write_pajek
Write a graph in Pajek (.net) format.

Type Aliases§

AstarHeuristic
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.
BellmanFordPathEntry
One entry in the result of bellman_ford_paths: Some((vertices, edges)) if the target is reachable, None otherwise.
IgraphResult
Convenience alias for Result<T, IgraphError>.
Mincut
Result of the global minimum cut computation.
VertexId
Vertex id. The Phase-0 ADR-0007 fixes this to u32; Option<VertexId> is the idiomatic “no vertex” sentinel (igraph C uses -1).
WidestPathResult
One entry of widest_paths_to’s output: Some((vertices, edges)) for a reachable target, None for unreachable. Each vertex chain begins with the source and ends with the target; each edge chain has length one less.