1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use fdg_sim::{ForceGraph, ForceGraphHelper, Simulation, SimulationParameters};
fn main() {
let mut graph: ForceGraph<(), ()> = ForceGraph::default();
let one = graph.add_force_node("one", ());
let two = graph.add_force_node("two", ());
let _three = graph.add_force_node("three", ());
graph.add_edge(one, two, ());
let mut simulation = Simulation::from_graph(graph, SimulationParameters::default());
for frame in 0..50 {
simulation.update(0.035);
println!("---- frame {frame} ----");
for node in simulation.get_graph().node_weights() {
println!("\"{}\" - {:?}", node.name, node.location);
}
}
}