#dag #graph #incremental #topological #value

incremental-topo

Data structure to maintain an incremental topological ordering over a collection of values

7 releases

Uses new Rust 2024

0.3.1 Mar 29, 2025
0.3.0 Mar 29, 2025
0.2.1 Jul 14, 2022
0.1.2 Aug 2, 2019
0.1.1 Sep 19, 2018

#282 in Data structures

Download history 471/week @ 2024-12-23 496/week @ 2024-12-30 601/week @ 2025-01-06 538/week @ 2025-01-13 650/week @ 2025-01-20 633/week @ 2025-01-27 669/week @ 2025-02-03 644/week @ 2025-02-10 605/week @ 2025-02-17 582/week @ 2025-02-24 570/week @ 2025-03-03 570/week @ 2025-03-10 616/week @ 2025-03-17 753/week @ 2025-03-24 801/week @ 2025-03-31 849/week @ 2025-04-07

3,094 downloads per month
Used in p2panda-rs

MIT/Apache

44KB
548 lines

Incremental Topo

Crates.io Travis CI Documentation

A data structure for maintaining an topological ordering in an incremental fashion.

Usage

To use incremental-topo, first add this to your Cargo.toml:

[dependencies]
incremental-topo = "0.3.1"

Next, add this to your crate:

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 for more details.

License

This project is dual licensed under the MIT license and Apache 2.0 license.

Dependencies

~165KB