Skip to main content

subgraph_centrality

Function subgraph_centrality 

Source
pub fn subgraph_centrality(graph: &Graph) -> IgraphResult<Vec<f64>>
Expand description

Compute subgraph centrality for all vertices.

SC(v) = (e^A)_{vv} = Σ_j (φ_j(v))² · exp(λ_j)

where φ_j is the j-th eigenvector and λ_j the corresponding eigenvalue. Measures the participation of vertex v in all subgraphs (closed walks), weighted exponentially by length.

§Examples

use rust_igraph::{Graph, subgraph_centrality};

// K_3: all vertices are symmetric, so all SC values are equal
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let sc = subgraph_centrality(&g).unwrap();
assert!((sc[0] - sc[1]).abs() < 0.01);
assert!((sc[1] - sc[2]).abs() < 0.01);