Skip to main content

betweenness_centrality

Function betweenness_centrality 

Source
pub fn betweenness_centrality<V>(
    q: &GraphQuery<V>,
    weight: &TraversalWeight<V>,
) -> HashMap<V::Id, f64>
where V: GraphValue + Clone, V::Id: Clone + Eq + Hash + Ord,
Expand description

Betweenness centrality using the Brandes BFS algorithm (unnormalized).

Returns the unnormalized betweenness score for each node. To normalize for an undirected graph with n nodes, divide by (n-1)(n-2)/2.

Uses the weight function to determine which edges are traversable (finite cost = reachable). All reachable edges are treated as unit-weight for the shortest-path counting phase.