oxygraph
oxygraph is a Rust library to analyse bipartite graphs, and implements several algorithms along with visualisations.
There is functionality to:
- Visualise bipartite graphs and their derivatives, as well as interaction matrices.
- Compute basic statistics on bipartite graphs and interaction matrices.
- Create random bipartite graphs through the Erdös-Rényi process.
- Algorithms for computing nestedness, and modularity.
The bipartite graphs are a thin wrapper over petgraph graphs, and the interaction matrices are two dimensional ndarrays.
As the wrappers are thin, implementation of new metrics/algorithms should be straightforward.
An example which illustrates initiation of the graph from a TSV:
// main bipartite graph struct
use BipartiteGraph;
// Which strata there are in a bipartite graph
use Strata;
// Interaction matrix struct
use InteractionMatrix;
// read in some data
// in the format:
// from to weight
// 0 1 1.0
// etc ...
let bpgraph = from_dsv.unwrap;
// is the graph bipartite?
let strata = bpgraph.is_bipartite;
match stata
// basic stats
println!;
// calculate NODF
let mut im = from_bipartite;
println!;
// make a random bipartite graph
let rand_graph = random.unwrap;
let mut im_rand = from_bipartite;
// and calculate modularity
let modularity = rand_graph.lpa_wb_plus;
println!;