[](https://crates.io/crates/fa2)
[](https://docs.rs/fa2/latest/fa2/)
# Rust `fa2` crate
[Full documentation](https://docs.rs/fa2/latest/fa2/)
---
The `fa2` crate provide a Rust implementation of the
[`ForceAtlas2`](https://doi.org/10.1371/journal.pone.0098679) graph layout
algorithm.
> Jacomy M, Venturini T, Heymann S, Bastian M (2014) ForceAtlas2, a Continuous
> Graph Layout Algorithm for Handy Network Visualization Designed for the Gephi
> Software. PLoS ONE 9(6): e98679. <https://doi.org/10.1371/journal.pone.0098679>
This implementation is generic over its float precision so you can run it with `f32`
or `f64`.
*Running the algorithm*
```rust
// First you need to populate the graph data on which the algorithm will run:
let mut data = FA2Data::<f32>::new();
// Then you need to instantiate settings
let settings = FA2Settings::default();
// Then you can build the layout runner
let layout = settings.build(data);
// Running a fixed number of iterations
layout.run(100);
// Retrieving positions
layout.data().positions()
```
For a command line tool able to run this implementation of the algorithm and/or
to read a real-life example, check out the [`run`](https://github.com/graphology/rust-fa2/blob/master/examples/run.rs)
example of this crate.