A data structure for maintaining an topological ordering in an incremental fashion.
To use incremental-topo
, first add this to your Cargo.toml
:
toml
[dependencies]
incremental-topo = "0.1"
Next, add this to your crate:
```rust extern crate incremental_topo;
use incremental_topo::IncrTopo;
let mut dag = IncrementalTopo::new();
dag.addnode("dog"); dag.addnode("cat"); dag.add_node("human");
assert_eq!(dag.size(), 3);
dag.adddependency("human", "dog").unwrap(); dag.adddependency("human", "cat").unwrap(); dag.add_dependency("dog", "cat").unwrap();
let animal_order: Vec<_> = dag.descendants("human").unwrap().map(|v| *v).collect();
asserteq!(animalorder, vec!["human", "dog", "cat"]); ```
See documentation for more details.
This project is dual licensed under the MIT license and Apache 2.0 license.