Force-directed layout
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Undirected graphs (`graph` as opposed to `digraph`) should use a force-directed layout algorithm, analogous to Graphviz's `neato` engine. The Fruchterman-Reingold algorithm is a good fit for the initial implementation.
Nodes are initialized on a grid or with random positions, then iteratively adjusted: repulsive forces push all node pairs apart (inverse-square law), attractive forces pull connected nodes together (spring model along edges), and a cooling schedule gradually reduces the maximum displacement per iteration. Around 300 iterations is typically sufficient for convergence. The initial implementation uses O(V²) all-pairs repulsion, which is acceptable for small-to-medium graphs. Barnes-Hut optimization for large graphs can be added later.
References
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the renderer and graph-layout entry points for undirected graphs in this Rust repository, then compare them with the existing directed-graph path. Implement the Fruchterman-Reingold approach described here with initialization, all-pairs repulsion, spring attraction, cooling, and roughly 300 iterations. Done means undirected graphs render with the force-directed layout; no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100