Algorithms, operations, generators, and representations for directed graphs
Installation
Add the following to your Cargo.toml:
[]
= "0.42.1"
To use stable Rust, turn off the adjacency_matrix feature:
[]
= { = "0.42.1", = false }
Overview
Operations
Build and query graphs made with standard collections, or implement the operation traits for your types.
use ;
let mut graph = empty;
// 1 ← 0 → 2
graph.add_edge;
graph.add_edge;
assert_eq!;
assert_eq!;
assert_eq!;
graph.remove_edge;
assert_eq!;
assert_eq!;
assert_eq!;
Algorithms
Search, traverse, and analyze graphs built from the types that implement the operation traits.
use single_pair_shortest_path as spsp;
// 0 ← 1
// ↑ ↑
// 3 → 2
let graph = ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Representations
An adjacency matrix representation is available with the adjacency_matrix feature.
use ;
let mut graph = new;
graph.add_edge;
assert!;
graph.add_edge;
assert!;
Generators
Generate parameterized graphs.
use Cycle;
let graph = Vec::cycle;
assert_eq!;
Changelog
See CHANGELOG.md.
License
Licensed under either the Apache License, Version 2.0 or the MIT license at your option.