label_propagation

Function label_propagation 

Source
pub fn label_propagation<N, E, Ix>(
    graph: &Graph<N, E, Ix>,
    max_iterations: usize,
) -> HashMap<N, usize>
where N: Node + Clone + Hash + Eq + Debug, E: EdgeWeight, Ix: IndexType,
👎Deprecated since 0.1.0-beta.2: Use label_propagation_result instead
Expand description

Label propagation algorithm for community detection (legacy API)

Note: This function is deprecated in favor of label_propagation_result. It will be removed in version 2.0.

Each node adopts the label that most of its neighbors have, with ties broken randomly. Returns a mapping from nodes to community labels.

§Time Complexity

O(k * m) where k is the number of iterations (typically small) and m is the number of edges. The algorithm often converges in 5-10 iterations.

§Space Complexity

O(n) for storing labels and temporary data structures.