Skip to main content

local_scan_0

Function local_scan_0 

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

Local scan-0: vertex degree (unweighted) or strength (weighted).

For k = 0 the scan statistic is defined as the degree (or weighted strength) of each vertex.

ยงExamples

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

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