Skip to main content

dispersion_node

Function dispersion_node 

Source
pub fn dispersion_node(
    graph: &Graph,
    u: &str,
    alpha: f64,
    b: f64,
    c: f64,
) -> Option<Vec<(String, f64)>>
Expand description

br-r37-c1-dispego: single-node (ego) Backstrom-Kleinberg dispersion.

Computes dispersion(G, u) — the canonical “find the partner” query — in a LOCAL universe restricted to N(u), avoiding the whole-graph bitset allocation of dispersion_full (an O(|V|) tax to answer about one node). Every set in the predicate is a subset of N(u): common = N(u) ∩ N(v) is cn[v], and nbrs_s ∩ N(t) equals nbrs_s ∩ (N(t) ∩ N(u)) = nbrs_s ∩ cn[t] because nbrs_s ⊆ N(u). disp is the same order-invariant integer proven byte-identical to the Python path in dispersion_full, so the (disp+b)^alpha / (emb+c) values match exactly. Returns (neighbour, value) pairs in graph.neighbors(u) order. Caller gates to undirected, simple, loop-free graphs with the normalized formula (matching dispersion_full).