Skip to main content

local_scan_k_ecount

Function local_scan_k_ecount 

Source
pub fn local_scan_k_ecount(
    graph: &Graph,
    k: u32,
    weights: Option<&[f64]>,
    mode: DegreeMode,
) -> IgraphResult<Vec<f64>>
Expand description

Mode-aware local scan-k edge count / weight sum.

For each vertex, counts edges (or sums edge weights) whose both endpoints lie within the k-neighbourhood. Supports directed modes.

ยงExamples

use rust_igraph::{Graph, local_scan_k_ecount, DegreeMode};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
let res = local_scan_k_ecount(&g, 2, None, DegreeMode::All).unwrap();
assert!((res[0] - 2.0).abs() < 1e-10);
assert!((res[1] - 3.0).abs() < 1e-10);