pub fn has_multiple(graph: &Graph) -> IgraphResult<bool>Expand description
Returns true iff graph has at least one parallel edge.
For undirected graphs, two self-loops at the same vertex do count
as parallel (matching upstream igraph_has_multiple()), but a single
self-loop does not. For directed graphs, (a, b) and (b, a) are
distinct so only same-direction repeats count.
O(|E| log |E|) via sort-and-scan over stored edges. Storage already
canonicalises undirected endpoints to from <= to, so (a,b) and
(b,a) collapse to the same canonical pair, which is exactly the
behaviour we want.
ยงExamples
use rust_igraph::{Graph, has_multiple};
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert!(!has_multiple(&g).unwrap());
g.add_edge(0, 1).unwrap();
assert!(has_multiple(&g).unwrap());