Interactive, draggable modal for tuning force-directed graph layout parameters in real-time. It runs directly against the active Redstring graph (no preview canvas), so every tick is applied to the live instances you see on NodeCanvas.
Redstring Menu → Debug → Force Simulation Tuner
- Applies forces straight onto the active graph via the Zustand store
- Play/Pause the solver without leaving NodeCanvas
- Reset injects jitter + alpha=1.0 so stacked nodes instantly separate
- Play/Pause: Start or stop the simulation
- Reset: Randomize node positions and restart from alpha=1.0
- Apply to Graph: Apply the current positions to your actual Redstring graph
- Layout Scale Slider (0.5–2.5×): Controls the global spacing multiplier saved in
autoLayoutSettings.layoutScaleMultiplier. The new adaptive solver amplifies this value on large graphs, so sliding toward Spacious now meaningfully expands dense clusters. - Scale Presets (Compact / Balanced / Spacious): Chips that set both the preset key and reset the multiplier to 1.0. Auto-layout, auto-graph generation, and the tuner stay in sync.
- Iteration Presets (Fast / Balanced / Deep): Updates
autoLayoutSettings.layoutIterations. Large graphs automatically add extra passes on top of the preset so Deep genuinely performs a longer settle. - The tuner reads + writes these same settings, so whatever you dial in here is exactly what
Auto-Layout Active GraphandGenerate Test Graphwill use (including the adaptive spread multiplier + multi-phase cooling introduced in 2025.11).
- Default: 2000
- How strongly nodes push away from each other
- Higher values = more spread out
- Too high = nodes fly away
- Too low = nodes clump together
- Default: 0.5
- Spring strength along edges (connected nodes)
- Higher values = edges pull nodes closer
- Lower values = looser connections
- Default: 200
- Desired distance between connected nodes
- The "rest length" of edge springs
- Adjust based on your node size and desired spacing
- Default: 0.1
- How strongly nodes are pulled toward the center
- Prevents graph from drifting off canvas
- Higher values = tighter clustering toward center
- Default: 60
- Prevents nodes from overlapping
- Should match your actual node size
- Visual representation shown in the preview
- Default: 0.02
- How quickly the simulation "cools down"
- Lower values = simulation runs longer
- Higher values = faster convergence
- Default: 0.4
- Friction/damping on node movement
- Lower values = bouncier, more movement
- Higher values = smoother, slower settling
- Open the tuner from Debug menu
- Drag the modal by its header to reposition
- Adjust parameters using the sliders
- Click Play to start the simulation
- Watch as nodes arrange themselves
- Pause when you like the layout
- Fine-tune parameters as needed
- Apply to Graph to update your actual Redstring graph
- Increase Repulsion Strength (3000-4000)
- Increase Link Distance (300-400)
- Lower Attraction Strength (0.2-0.3)
- Lower Repulsion Strength (1000-1500)
- Decrease Link Distance (100-150)
- Increase Center Force (0.3-0.5)
- High Attraction Strength (1.0-1.5)
- Lower Repulsion Strength (1500-2000)
- Moderate Link Distance (150-200)
- Moderate all values
- Lower Velocity Decay (0.2-0.3) for more movement
- Run simulation longer (lower Alpha Decay)
Custom force-directed layout implementation based on:
- N-body repulsion (Barnes-Hut style, but O(n²) for simplicity)
- Edge Repulsion (Triplets): Edges repel each other to improve angular resolution, except for parallel edges (same two nodes).
- Spring forces on edges
- Centering force
- Collision detection and resolution
- Alpha cooling schedule
- The core solver in
src/services/graphLayoutService.jsnow computes an auto spread multiplier from node count + cluster count. The tuner feeds it by writing layout-scale settings back through the store. - Repulsion, spring targets, and collision radii run in three phases (expand → stabilize → settle) so large graphs open up quickly and then lock into a steady state without drifting.
- After each run, the shared service performs cluster anchoring, multi-pass collisions, and radial relaxation. Running auto-layout after a tuning session gives you the exact same pipeline.
- Runs at 60 FPS in browser
- Real-time parameter updates
- Suitable for graphs up to ~50-100 nodes
- Larger graphs may need optimization
- Edge Repulsion Impact: Adds O(E²) complexity. For very dense graphs (>500 edges), consider disabling
enableEdgeRepulsion.
/src/components/ForceSimulationModal.jsx- Main component/src/components/ForceSimulationModal.css- Styling- Integrated into
NodeCanvas.jsx,Header.jsx, andRedstringMenu.jsx
- D3-force integration for better performance
- Preset parameter configurations
- Export/import parameter sets
- Grid/hierarchical constraint options
- WebWorker-based simulation for large graphs