Skip to main content

plan_graph_split

Function plan_graph_split 

Source
pub fn plan_graph_split(
    source_vshard: u32,
    new_vshard: u32,
    target_node: u64,
    node_ids: &[String],
    edges: &[(String, String)],
) -> SplitPlan
Expand description

Plan a graph-aware shard split.

Uses BFS-based community detection to partition nodes into two groups that minimize cross-shard edges. Starting from a seed node, BFS assigns the first half of discovered nodes to group A, the rest to group B.

This is a greedy heuristic — not optimal like METIS, but O(V+E) and practical for online splitting without blocking queries.