Force-directed graph layout, ported twice while learning: once in C++ with OpenGL, once in Rust with wgpu.
graft is a d3-force-inspired force simulation engine, implemented as two independent learning projects now merged into a single repository:
- graft-gl — C++ / OpenGL
- graft-wgpu — Rust / wgpu
Both implement the same underlying physics (many-body repulsion, links, centering, collision) so the two can be compared side by side as different takes on the same problem, in different languages and graphics APIs.
The name nods to graph nodes grafted together from two branches of the same idea — and, conveniently, to Kraft, German for force.
graft/
├── graft-gl/ # C++ / OpenGL port
├── graft-wgpu/ # Rust / wgpu port
├── assets/ # logo, favicon, screenshots
└── README.md
(adjust to match your actual folder names once merged)
- Force simulation: many-body (charge), link, center, and collision forces
- Real-time interactive rendering
- Two independent implementations for comparison:
graft-gl: C++, OpenGLgraft-wgpu: Rust, wgpu
cd graft-gl
mkdir build && cd build
cmake ..
cmake --build .
./src/particle_system_gl(update with your actual build system / dependencies, e.g. GLFW, GLEW/GLAD)
cd graft-wgpu
cargo run --bin graph_gui - d3-force by Mike Bostock — the algorithm reference both ports are based on