Skip to main content

edge_vertex_ratio

Function edge_vertex_ratio 

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

Compute the edge-vertex ratio.

m / n — the number of edges per vertex (half the average degree). Returns 0.0 for graphs with no vertices.

§Examples

use rust_igraph::{Graph, edge_vertex_ratio};

// K_3: m=3, n=3, ratio=1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((edge_vertex_ratio(&g).unwrap() - 1.0).abs() < 1e-10);