Skip to main content

multi_edge_ratio

Function multi_edge_ratio 

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

Compute the multi-edge ratio of the graph.

Fraction of edges that are duplicates (i.e., share the same pair of endpoints with at least one other edge). For undirected graphs, edges (u,v) and (v,u) are the same. Returns 0.0 for graphs with no edges.

§Examples

use rust_igraph::{Graph, multi_edge_ratio};

// Simple triangle — no multi-edges → 0.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(multi_edge_ratio(&g).unwrap().abs() < 1e-10);