Skip to main content

cluster_incremental

Function cluster_incremental 

Source
pub fn cluster_incremental(
    graph: &KnowledgeGraph,
    prev_communities: &HashMap<usize, Vec<String>>,
    changed_files: &[String],
) -> HashMap<usize, Vec<String>>
Expand description

Incrementally re-cluster only the communities affected by changed files.

Instead of re-running Leiden on the entire graph, this:

  1. Identifies nodes belonging to changed_files
  2. Finds which communities are affected (contain changed nodes or their neighbors)
  3. Re-runs Leiden only on the affected subgraph
  4. Merges with unchanged communities

Falls back to full cluster() if > 50% of communities are affected.