Skip to main content

local_scan_subset_ecount

Function local_scan_subset_ecount 

Source
pub fn local_scan_subset_ecount(
    graph: &Graph,
    subsets: &[Vec<VertexId>],
    weights: Option<&[f64]>,
) -> IgraphResult<Vec<f64>>
Expand description

Local scan on given vertex subsets: count edges (or sum weights) in the induced subgraph of each subset.

ยงExamples

use rust_igraph::{Graph, local_scan_subset_ecount};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
g.add_edge(2, 3).unwrap();
let subsets = vec![vec![0, 1, 2], vec![2, 3]];
let res = local_scan_subset_ecount(&g, &subsets, None).unwrap();
assert!((res[0] - 3.0).abs() < 1e-12);
assert!((res[1] - 1.0).abs() < 1e-12);