This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit 47e4732
committed
feat: add GraphPartitioner — balanced k-way graph partitioning
Three partitioning strategies:
- BFS-based: grows partitions from farthest-first seed vertices
using round-robin breadth-first expansion for balanced sizes
- Kernighan-Lin: BFS initial + iterative vertex pair swaps to
minimize edge cuts (extends to k-way via pairwise refinement)
- Spectral bisection: Fiedler vector (2nd Laplacian eigenvector)
via power iteration + deflation, recursive bisection for k-way,
refined with KL swaps
PartitionResult provides:
- Per-vertex partition assignment
- Edge cut count and cut ratio
- Imbalance ratio (max partition size / ideal size)
- Per-partition metrics: size, internal/external edges, conductance
- Members list per partition
- Formatted toString() summary
729 lines source + 465 lines tests (36 tests). All tests pass.1 parent 031fde2 commit 47e4732
2 files changed
Lines changed: 1194 additions & 0 deletions
0 commit comments