# Incremental Topo
[](https://crates.io/crates/incremental-topo)
[](https://travis-ci.com/declanvk/incremental-topo)
[](https://docs.rs/incremental-topo)
A data structure for maintaining an topological ordering in an incremental fashion.
## Usage
To use `incremental-topo`, first add this to your `Cargo.toml`:
```toml
[dependencies]
incremental-topo = "0.2.1"
```
Next, add this to your crate:
```rust
use incremental_topo::IncrementalTopo;
let mut dag = IncrementalTopo::new();
let cat = dag.add_node();
let dog = dag.add_node();
let human = dag.add_node();
assert_eq!(dag.len(), 3);
dag.add_dependency(&human, &dog).unwrap();
dag.add_dependency(&human, &cat).unwrap();
dag.add_dependency(&dog, &cat).unwrap();
let animal_order: Vec<_> = dag.descendants(&human).unwrap().collect();
assert_eq!(animal_order, vec![dog, cat]);
```
See [documentation](https://docs.rs/incremental-topo) for more details.
## License
This project is dual licensed under the [MIT license](LICENSE-MIT) and [Apache 2.0 license](LICENSE-APACHE).