Why GPU Layout?
Force-directed layout algorithms are computationally expensive:- Each iteration computes forces between all node pairs: O(n²)
- Large graphs need thousands of iterations
- CPU computation becomes impractical for 1000+ nodes
Performance
| Nodes | CPU Time | GPU Time | Speedup |
|---|---|---|---|
| 100 | 0.5s | 0.3s | 1.7x |
| 1,000 | 8s | 1.2s | 6.7x |
| 5,000 | 120s | 4s | 30x |
| 10,000 | 600s+ | 12s | 50x+ |
Architecture
.NET API Server
RustGpuLayoutAdapter implements ILayoutCompute portWebSocket
Internal connection on
ws://localhost:9002Layout Server (Rust)
wgpu for GPU abstraction, ForceAtlas2 with Barnes-Hut
GPU Compute
Metal (macOS) or Vulkan (Linux/Windows)
The browser never connects directly to the GPU server. All communication goes through the .NET API.
Key Concepts
| Concept | Description |
|---|---|
| ForceAtlas2 | The force-directed layout algorithm |
| Protocol | WebSocket message format |