daggy

A directed acyclic graph data structure for Rust.
It is implemented on top of petgraph's Graph data structure and attempts to follow similar conventions where suitable.
Usage
Use daggy in your project by adding it to your Cargo.toml dependencies:
[]
= "0.8.1"
# Enables the `StableDag` type.
= { = "0.8.1", = ["stable_dag"] }
# Allows the `Dag` to be serialized and deserialized.
= { = "0.8.1", = ["serde-1"] }
Examples
Please see the tests directory for some basic usage examples.
Transitive reduction:
use Dag;
let mut dag = new;
// Reduce edges:
//
// ```text
// # Before: | # After:
// |
// a -> b ----. | a -> b ----.
// | | | | |
// |-> c ----|----. | '-> c |
// | \ | | | \ |
// | \ v | | \ v
// |------>> d | | '> d
// | \ v | \
// '----------->> e | '> e
// ```
let a = dag.add_node;
let = dag.add_child;
let = dag.add_child;
let = dag.add_child;
let = dag.add_child;
dag.add_edge.unwrap;
dag.add_edge.unwrap;
dag.add_edge.unwrap;
dag.add_edge.unwrap;
assert_eq!;
dag.transitive_reduce;
let mut edges = dag.graph.edge_weights.copied.;
edges.sort;
assert_eq!;
assert_eq!;
License
Dual-licensed to be compatible with the petgraph and Rust projects.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.