Skip to main content

distance_spectral_radius

Function distance_spectral_radius 

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

Compute the distance spectral radius ρ_D = λ_1(D).

The largest eigenvalue of the distance matrix. For connected undirected graphs only.

§Examples

use rust_igraph::{Graph, distance_spectral_radius};

// K_3: distance matrix has all off-diag = 1, so ρ_D = 2
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let rho = distance_spectral_radius(&g).unwrap();
assert!((rho - 2.0).abs() < 0.1);