Skip to main content

average_sombor_index

Function average_sombor_index 

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

Compute the average Sombor index.

SO_avg(G) = SO(G) / m

Returns 0.0 for graphs with no edges.

ยงExamples

use rust_igraph::{Graph, average_sombor_index};

// K_3: SO = 6โˆš2, m = 3 โ†’ SO_avg = 2โˆš2
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((average_sombor_index(&g).unwrap() - 2.0 * std::f64::consts::SQRT_2).abs() < 1e-10);