Graph algorithms, operations, generators, and representations.
Installation
Add the following to your Cargo.toml
:
[]
= "0.32.2"
To use stable Rust, disable the adjacency_matrix
feature:
[]
= { = "0.32.2", = false }
Overview
Operations
Build and query graphs made with standard collections, or implement the operation traits for your types.
use ;
let mut graph = vec!;
// 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
Use custom graph 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 = cycle;
assert_eq!;
License
Licensed under either Apache License, Version 2.0 or MIT license at your option.