Skip to main content

dominance_ratio

Function dominance_ratio 

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

Compute the dominance ratio.

The neighborhood inclusion order: vertex u dominates v if N(v) ⊆ N(u)∪{u}. The dominance ratio is the fraction of directed pairs (u,v) where u dominates v. Values near 0 indicate no dominance relationships (random-like); values near 1 indicate a strongly hierarchical structure. Returns 0.0 for trivial or edgeless graphs.

§Examples

use rust_igraph::{Graph, dominance_ratio};

// Star K_{1,3}: center dominates leaves, and each leaf dominates other leaves
// (N(leaf_j)={center} ⊆ N(leaf_i)∪{leaf_i}), total 9/12 = 0.75
let g = Graph::from_edges(&[(0,1),(0,2),(0,3)], false, Some(4)).unwrap();
let r = dominance_ratio(&g).unwrap();
assert!((r - 0.75).abs() < 1e-10);