pub fn local_scan_1(
graph: &Graph,
weights: Option<&[f64]>,
) -> IgraphResult<Vec<f64>>Expand description
For each vertex, count edges within its closed 1-neighborhood.
The closed 1-neighborhood of vertex v is {v} ∪ neighbors(v).
This function counts all edges that have both endpoints in that set.
For undirected graphs, each such edge is counted once per vertex whose neighborhood contains it.
weights: optional edge weights (length must equal ecount()).
When provided, sums edge weights instead of counting edges.
Returns a vector of length vcount().
§Examples
use rust_igraph::{Graph, local_scan_1};
// Triangle: each vertex's 1-neighborhood is the whole graph.
// 3 edges in the neighborhood of each vertex.
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
let s = local_scan_1(&g, None).unwrap();
assert!((s[0] - 3.0).abs() < 1e-10);
assert!((s[1] - 3.0).abs() < 1e-10);
assert!((s[2] - 3.0).abs() < 1e-10);