-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestperformancePerformance improvementPerformance improvementpriority: lowLow priority issueLow priority issue
Description
Description
The current force-directed layout uses O(n²) all-pairs repulsion calculation. For graphs with 500+ nodes, this will become a performance bottleneck.
Current State
// src/ui/layout.rs:60-82
for i in 0..nodes.len() {
for j in (i + 1)..nodes.len() {
// O(n²) comparison
}
}Proposed Solution
Implement Barnes-Hut algorithm using a quadtree:
- Build quadtree of node positions each frame
- For distant node clusters, approximate as single point mass
- Only compute exact forces for nearby nodes
- Reduces complexity to O(n log n)
Acceptance Criteria
- Implement quadtree data structure
- Implement Barnes-Hut approximation (theta parameter ~0.5)
- Add benchmark comparing O(n²) vs O(n log n) for various graph sizes
- Fallback to simple algorithm for small graphs (<100 nodes)
- No visual regression for typical graph sizes
Files Affected
src/ui/layout.rs- New:
src/ui/layout/quadtree.rs(optional)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestperformancePerformance improvementPerformance improvementpriority: lowLow priority issueLow priority issue