Skip to content

beatussum/petgraph-paralgs

petgraph-paralgs

crates.io license crates.io version deps.rs crate dependencies (latest) GitHub commits since latest release GitHub last commit GitHub release date

petgraph-paralgs provides some parallel graph algorithms using the API of the Rust petgraph library, and powered by rayon.

This project was inspired by the graphalgs crate.

Example

use petgraph::Graph;
use petgraph_paralgs::algo::delta_stepping;

let mut graph = Graph::<_, u32>::new();

let a = graph.add_node(());
let b = graph.add_node(());
let c = graph.add_node(());
let d = graph.add_node(());
let e = graph.add_node(());
let f = graph.add_node(());

graph.extend_with_edges([
    (a, b, 2),
    (a, d, 4),
    (b, c, 1),
    (b, f, 7),
    (c, e, 5),
    (e, f, 1),
    (d, e, 1),
]);

// Graph represented with the weight of each edge
// Edges with '*' are part of the optimal path.
//
//     2       1
// a ----- b ----- c
// | 4*    | 7     |
// d       f       | 5
// | 1*    | 1*    |
// \------ e ------/

let path = delta_stepping(&graph, a, |finish| finish == f, |e| *e.weight(), 2);
assert_eq!(path, Some((6, vec![a, d, e, f])));

Adding this crate to your project

First, you need to have a Rust toolchain installed. You can follow the instructions at this page. If you are a GNU/Linux user, it should be included in the official repositories of your favorite distribution. This project is based on the Cargo package manager.

cargo add petgraph-paralgs

Contributing

If you want to contribute to this project, please see this file first.

Licenses

As explained above, the code of this software is licensed under GPL-3 or any later version. Details of the rights applying to the various third-party files are described in the copyright file in the Debian debian/copyright file format.

About

Parallel graph algorithms based on the Rust petgraph library

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages