pub fn edgelist_percolation(
edges: &[(VertexId, VertexId)],
) -> Result<BondPercolation>Expand description
Bond percolation curve of a bare list of vertex pairs.
Edges (u, v) are added one after the other, and after each addition the
size of the largest connected component and the number of non-isolated
vertices are recorded. It differs from Graph::bond_percolation in that
no graph is needed: vertices are identified by the ids appearing in
edges, which must be non-negative (the largest id determines how much
memory is allocated). Self-loops are allowed.
This function is marked experimental in igraph.
Time complexity: O(|E| α(|E|)), α being the inverse Ackermann function.
Binds igraph_edgelist_percolation.
§Errors
ErrorKind::InvalidVertexId for negative vertex ids and for the id
i64::MAX (rejected on the Rust side: igraph 1.0.1 computes the vertex
count as the largest id plus one, which would overflow and abort the
process). ErrorKind::OutOfMemory when the largest id is too large
to allocate per-vertex storage for.
§Examples
use igraph::components::edgelist_percolation;
// A triangle with an extra self-loop on vertex 0.
let p = edgelist_percolation(&[(0, 0), (0, 1), (1, 2), (2, 0)]).unwrap();
assert_eq!(p.giant_size, vec![1, 2, 3, 3]);
assert_eq!(p.vertex_count, vec![1, 2, 3, 3]);