https://github.com/romnn/par-dfs
Parallel, serial, sync, and async DFS and BFS traversal for Rust
https://github.com/romnn/par-dfs
async bfs dfs graph parallel rayon rust stream sync tokio
Last synced: 3 months ago
JSON representation
Parallel, serial, sync, and async DFS and BFS traversal for Rust
- Host: GitHub
- URL: https://github.com/romnn/par-dfs
- Owner: romnn
- License: mit
- Created: 2022-09-13T08:37:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T21:16:03.000Z (about 1 year ago)
- Last Synced: 2025-03-24T20:13:38.307Z (10 months ago)
- Topics: async, bfs, dfs, graph, parallel, rayon, rust, stream, sync, tokio
- Language: Rust
- Homepage: https://romnn.github.io/par-dfs
- Size: 8.11 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## par-dfs
[
](https://github.com/romnn/par-dfs/actions/workflows/build.yml)
[
](https://github.com/romnn/par-dfs/actions/workflows/test.yml)
[
](https://romnn.github.io/par-dfs/)
[
](https://crates.io/crates/par-dfs)
[
](https://docs.rs/par-dfs)
Parallel, serial, and async DFS and BFS traversal iterators in Rust.
```toml
[dependencies]
par-dfs = "0"
```
#### Usage
For usage examples, check the [examples](https://github.com/romnn/par-dfs/tree/main/examples) and [documentation](https://docs.rs/par-dfs).
#### Examples
```bash
cargo run --example async_fs --features async -- --path ./
cargo run --example sync_fs --features sync,rayon -- --path ./
```
#### Benchmarking
```bash
cargo install cargo-criterion
# full benchmark suite
cargo criterion --features full
# sync benchmarks only
cargo criterion --features sync -- sync
# dfs benchmarks only
cargo criterion --features full -- dfs
```
Benchmark reports are available [here](https://romnn.github.io/par-dfs/).
#### Acknowledgements
The [`rayon::iter::ParallelIterator`](https://docs.rs/rayon/latest/rayon/iter/trait.ParallelIterator.html) implementation for the dynamically growing graph traversal is based on the amazing work in [tavianator's blog post](https://tavianator.com/2022/parallel_graph_search.html).
The implementation of [`futures_util::stream::Buffered`](https://docs.rs/futures-util/latest/src/futures_util/stream/stream/buffered.rs.html#12-25) also greatly helped in the design of the async streams.