关于
A Force Directed Graph Drawing Library
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文fdg
A (force-directed) graph drawing library for Rust. Convert any petgraph::Graph into a pretty picture!

The goal of this library is to create some idiomatic building blocks for writing fast graph drawing algorithms in Rust. I hope to implement more algorithms such as ForceAtlas2 (2014) and Kamada-Kawai (1989). I also want to experiment with generating the layouts with SIMD, parallelization, and GPU compute.
The library is currently undergoing a complete rewrite with more performant algorithms and a more generic API (now supports computing in N dimensions 😉). The pre 1.0 version is now located in the old branch.
Contributions always welcome!
Usage
use fdg::{fruchterman_reingold::FruchtermanReingold, Force, ForceGraph};
// your dataset: Into<StableGraph<(), ()>>
// Initialize a ForceGraph in 2 dimentions with random node positions from -10.0..=10.0.
let mut graph: ForceGraph<f32, 2, (), ()> = fdg::init_force_graph_uniform(dataset, 10.0);
// Apply the Fruchterman-Reingold (1991) force-directed drawing algorithm 100 times.
FruchtermanReingold::default().apply_many(&mut graph, 100);
// Center the graph's average around (0,0).
Center::default().apply(&mut graph);
// Render nodes:
println!("nodes:");
for (_, pos) in graph.node_weights() {
println!("{pos:?}");
}
// Render edges:
println!("edges:");
for edge_idx in graph.edge_indices() {
let (source_idx, target_idx) = graph.edge_endpoints(edge_idx).unwrap();
println!("{edge_idx:?}: {:?} to {:?}", &graph[source_idx].1, &graph[target_idx].1);
}
See basic.rs...
探索相关项目
加载中…