Skip to main content

distance_energy

Function distance_energy 

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

Compute the distance energy E_D = Σ |λ_i(D)|.

The sum of absolute values of all distance matrix eigenvalues.

§Examples

use rust_igraph::{Graph, distance_energy};

// K_3: eigenvalues {2, -1, -1}, E_D = 4
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let e = distance_energy(&g).unwrap();
assert!((e - 4.0).abs() < 0.1);