Skip to main content

Module prelude

Module prelude 

Source
Expand description

Minimal import set for common use cases.

use rust_igraph::prelude::*;

This re-exports only the essential types and the most frequently used algorithms. For the full API, import directly from the crate root:

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

Re-exports§

pub use crate::algorithms::cliques::clique_number;
pub use crate::algorithms::constructors::famous::famous;
pub use crate::algorithms::constructors::full::full_graph;
pub use crate::algorithms::constructors::ring::cycle_graph;
pub use crate::algorithms::games::barabasi::barabasi_game_bag;
pub use crate::algorithms::games::erdos_renyi::erdos_renyi_gnp;
pub use crate::algorithms::games::watts::watts_strogatz_game;

Structs§

BipartiteResult
Result of bipartiteness check.
Graph
Counterpart of igraph_t (see references/igraph/include/igraph_datatype.h).
GraphBuilder
A fluent builder for constructing Graph instances.
GraphSummary
Result of graph_summary containing precomputed graph statistics.
HitsScores
Output of hub_and_authority_scores: scaled hub and authority vectors and the dominant eigenvalue of A·Aᵀ.
NeighborsIter
Zero-allocation iterator over the neighbors of a vertex.

Enums§

AttributeValue
A single attribute value attached to a graph, vertex, or edge.
ConnectednessMode
Connectivity mode for directed graphs.
DegreeMode
Direction mode for degree computation in directed graphs.
IgraphError
All errors returned from rust-igraph.
MstAlgorithm
Selector for the minimum-spanning-tree algorithm.

Functions§

articulation_points
Articulation points of graph (returns vertices in upstream’s DFS-discovery order).
betweenness
Per-vertex (unweighted) 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.
bridges
Bridges of graph — edges whose removal would increase the number of (weakly) connected components.
closeness
Per-vertex closeness centrality (Vec<Option<f64>>).
connected_components
Compute the weak connected components of graph.
coreness
Per-vertex coreness number.
count_triangles
Count the number of triangles in graph. Edge directions, parallel edges, and self-loops are ignored.
degree_sequence
Returns the degree sequence of the graph.
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_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.
dijkstra_distances
Single-source Dijkstra distances.
dijkstra_paths
Single-source Dijkstra returning distances + parents + inbound edges over 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.
eigenvector_centrality
Backward-compatible undirected, unweighted entry point.
get_shortest_paths
Returns one shortest path from source to every vertex in the graph.
graph_summary
Compute a quick structural summary of a graph.
harmonic_centrality
Per-vertex harmonic centrality.
hub_and_authority_scores
Compute Kleinberg’s hub and authority scores.
is_bipartite
Check whether a graph is bipartite and optionally return the partition.
is_connected
Tests whether the graph is connected.
is_simple
Returns true if graph has neither self-loops nor parallel edges.
isomorphic_vf2
Test whether two graphs are isomorphic using the VF2 algorithm.
katz_centrality
Compute Katz centrality for all vertices using power iteration.
leiden
Run Leiden with the default modularity objective, γ = 1, β = 0.01, two iterations, seed 0.
list_triangles
List all triangles in a graph.
louvain
Run Louvain with the default options (γ = 1, unweighted, deterministic seed 0).
max_flow
Full maximum-flow computation: value, per-edge flow, cut edges, and source-side / sink-side vertex partitions.
mean_distance
Mean unweighted shortest-path length over all reachable ordered pairs. Counterpart of igraph_average_path_length(_, NULL_weights, _, _, /*directed=*/true, /*unconn=*/true).
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.
modularity
Modularity of graph with respect to community assignment membership.
pagerank
PageRank scores via power iteration with damping 0.85.
radius
Radius of graph — the minimum vertex eccentricity. None for a graph with no vertices (matches upstream’s IGRAPH_NAN for the null graph).
strongly_connected_components
Compute the strongly connected components of graph.
topological_sorting
Returns a topological ordering of graph’s vertices.
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.

Type Aliases§

EdgeIter
Iterator over graph edges as (from, to) pairs.
IgraphResult
Convenience alias for Result<T, IgraphError>.
VertexId
Vertex id. The Phase-0 ADR-0007 fixes this to u32; Option<VertexId> is the idiomatic “no vertex” sentinel (igraph C uses -1).