Skip to main content

eigenvector

Function eigenvector 

Source
pub fn eigenvector<N>(
    nodes: &[N],
    edges: &[(N, N, f32)],
    max_iterations: usize,
    tolerance: f64,
) -> Vec<(N, f64)>
where N: Clone + Ord,
Expand description

Eigenvector centrality over an abstract undirected, unweighted graph via power iteration on the adjacency matrix.

max_iterations caps the power-iteration sweeps; tolerance is the L1 convergence threshold on successive (normalised) iterates. The returned vector is L2-normalised, so every score lies in [0, 1] and the Perron–Frobenius principal eigenvector is non-negative. An isolated node (no incident edges) scores 0.0 whenever the graph has any edges; an edgeless graph has no well-defined dominant eigenvector, so every node gets the uniform value 1/√n (still L2-normalised).

Output: one (node, score) pair per distinct node, ordered by node ascending. Deterministic: fixed uniform start vector, ascending sweep order, sign fixed non-negative by construction.