Skip to main content

count_multiple_1

Function count_multiple_1 

Source
pub fn count_multiple_1(graph: &Graph, eid: u32) -> IgraphResult<usize>
Expand description

Multiplicity of a single edge: how many edges share the same endpoint pair as edge eid.

Counterpart of igraph_count_multiple_1() from references/igraph/src/properties/multiplicity.c.

O(deg(from)) — scans the neighbors of the edge’s source vertex.

§Examples

use rust_igraph::{Graph, count_multiple_1};

let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert_eq!(count_multiple_1(&g, 0).unwrap(), 2);
assert_eq!(count_multiple_1(&g, 2).unwrap(), 1);