An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

## par-dfs

[build status](https://github.com/romnn/par-dfs/actions/workflows/build.yml)
[test status](https://github.com/romnn/par-dfs/actions/workflows/test.yml)
[benchmarks](https://romnn.github.io/par-dfs/)
[crates.io](https://crates.io/crates/par-dfs)
[docs.rs](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.