fdg
A Force-Directed Graph Library for Rust.
The goal of this project is to provide a force-directed graph drawing framework for Rust, as well as 2D and 3D visualizers/renderers that work on the web and desktop. It's built on top of the popular petgraph
Rust library for interaction with already existing datasets in Rust.
In the simplest terms, the crates in this project allow you to take a graph and turn it into a pretty picture.
Crates
Name | Version | Docs | License | Description |
---|---|---|---|---|
fdg-sim |
Runs the layout engine (simulation) and manages the position of nodes. | |||
fdg-macroquad |
A demo visualizer that lets you interact with the graph in real time. (View Online) | |||
fdg-img |
A simple SVG renderer for your graphs. | |||
fdg-wasm |
A simple Webassembly wrapper of fdg-sim for use in Javascript. |
Stability Note/Future Plans:
Note: There are some parts of this library that are certainly not as polished as I'd like them to be. My Rust API (and calculus) abilities have improved quite a bit since I first wrote this library, and there is a lot of room for improvement.
While the library is certainly usable, there are a few things that I'd like to address in an upcoming 1.0+:
- Lack of "state of the art" (post 1996) force algorithms such as ForceAtlas2.
- Only simple Euler method instead of more stable RK4 or Leapfrog integration.
- Unnecessary
Clone
requirement forNode
data (and associated "hot-clones" π¬).- Opaque
Force
struct containing a function pointer instead of an idiomaticForce
trait.- Buggy node dragging in fdg-macroquad.
- Awkwardly worded documentation.
- Unpolished WASM API.
- Sometimes buggy/inflexible DOT/GML/jsongraph parsers.
- Broken self-connected nodes.
Resources
- Force-Directed Graphs on Wikipedia
- Force Directed Drawing Algorithms (Kobourov)
- Example Javascript force directed graph layout engines d3-force and ngraph.forcelayout