Skip to main content

modularity_weighted_directed

Function modularity_weighted_directed 

Source
pub fn modularity_weighted_directed(
    graph: &Graph,
    membership: &[u32],
    resolution: f64,
    weights: &[f64],
) -> IgraphResult<Option<f64>>
Expand description

Directed weighted modularity (Leicht-Newman, ALGO-CO-006c follow-up).

Combines the directed normalisation of modularity_directed (split out-strength / in-strength) with the per-edge weighting of modularity_weighted:

Q = (1 / W) Σ_{ij} (W_ij − γ s_out_i * s_in_j / W) δ(c_i, c_j)

where W = Σ_e w_e, s_out_i = Σ_{j: i→j} w_{ij}, s_in_j = Σ_{i: i→j} w_{ij}, and W_ij is the weighted adjacency. Undirected graphs route to modularity_weighted (matching python-igraph’s “directed flag ignored on undirected” semantics).