Expand description

oxygraph is a crate to aid in the analysis of ecological bipartite graphs. Still in development and might support other ecological graph types in the future.

Creation of BipartiteGraph structs can be done through an input TSV:

use oxygraph;
use oxygraph::bipartite::Strata;

let path = "./path/to/bipartite.tsv";

// load into a BipartiteGraph structure
// a quick peek at the source codes shows you
// it's a thin wrapper over `petgraph`.
let bpgraph = oxygraph::BipartiteGraph::from_dsv(path, b'\t');

// check it's bipartite
let check = match bpgraph.is_bipartite() {
    Strata::Yes(_) => "it's bipartite!",
    Strata::No => "it's not bipartite :(",
};


// create an interaction matrix
let int_mat = oxygraph::InteractionMatrix::from_bipartite(bpgraph);
// and look at some basic stats
let stats = int_mat.stats();

Or by creating a petgraph graph e.g.:

use petgraph::Graph;
use oxygraph::bipartite::BipartiteGraph;

let mut graph: Graph<String, f64> = Graph::new();

// add nodes/edges etc...

// now wrap in `BipartiteGraph` and access
// all the methods associated.
let bpgraph = BipartiteGraph(graph);

More information and tutorials to follow.

Re-exports

pub use bipartite::BipartiteGraph;
pub use bipartite::BipartiteStats;
pub use int_matrix::InteractionMatrix;
pub use int_matrix::InteractionMatrixStats;
pub use derived::DerivedGraphStats;
pub use derived::DerivedGraphs;
pub use modularity::LpaWbPlus;

Modules

Create, analyse, and visualise bipartite graphs from tab delimited input data. A bipartite graph is one where there are nodes of two strata (or colours). Edges can form between these two strata, but not within.
The derived graphs of a bipartite graph.
Create, analyse, and visualise interaction matrices generated from a BipartiteGraph. A bipartite graph can be converted to an interaction matrix, which is a binary matrix representing all the possible combinations of hosts/parasites (or sites/species).
Modularity calculations are in their own module, but they are built on top of an interaction matrix. Included are two algorithms from Beckett 2016. Compute the modularity of an (optionally weighted) interaction matrix.
Sorting algorithms on arrays. Not written by myself, but by the great bluss.

Functions

Scale a number between zero and 1, given a min/max.