pub fn eigenvector_centrality_weighted(
graph: &Graph,
weights: &[f64],
) -> IgraphResult<EigenvectorScores>Expand description
Undirected weighted eigenvector centrality.
weights.len() must equal graph.ecount(). Returns the
max-1-normalised vector and the dominant eigenvalue of the weighted
symmetric adjacency W[i,j] = Σ_{e: i~j} w_e. Non-negative weights
are assumed (negative weights are accepted but a Perron-Frobenius
guarantee no longer applies and entries may be negative; matches
upstream).
All-zero weights and edge-less graphs both return a vector of 1s
and eigenvalue = 0, matching upstream’s sentinel.
Counterpart of igraph_eigenvector_centrality(g, &v, &λ, IGRAPH_ALL, weights, NULL).
§Examples
use rust_igraph::{Graph, eigenvector_centrality_weighted};
// Weighted star K_{1,4} with unit weights → leaf:centre = 1:2.
let mut g = Graph::with_vertices(5);
for v in 1..5 {
g.add_edge(0, v).unwrap();
}
let s = eigenvector_centrality_weighted(&g, &vec![1.0; g.ecount()]).unwrap();
assert!((s.vector[0] - 1.0).abs() < 1e-9);
assert!((s.vector[1] - 0.5).abs() < 1e-9);
assert!((s.eigenvalue - 2.0).abs() < 1e-6);