Skip to main content

compute_betweenness

Function compute_betweenness 

Source
pub fn compute_betweenness<N, E>(
    graph: &Graph<N, E, Directed>,
    normalized: bool,
) -> BetweennessResult
where N: ClassNode, E: EdgeKind,
Expand description

Compute betweenness centrality for every node in graph.

normalized=true matches networkx’s default behavior: scores are scaled by 1 / ((n-1)·(n-2)) for directed graphs with n ≥ 3. For n < 3 scores are returned unscaled (would divide by zero).

Treats the graph as directed and unweighted. To run on an undirected view of the same data, add reverse edges before calling.