Graaf

Functions and types for working with graphs
Graaf is Dutch for
- graph
- count
- dig
This crate is in alpha, and the API will change.
Installation
Add the following to your Cargo.toml:
[]
= "0.8.4"
Usage
use ;
let mut adj = new;
adj.add_edge;
adj.add_edge;
adj.add_edge;
adj.add_edge;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Features
Algorithms: algo
Breadth-first search: bfs
Dijkstra's algorithm: dijkstra
Operations: op
These traits are implemented for various graph representations built from standard library containers.
AddEdgeadds an unweighted edge.AddWeightedEdgeadds a weighted edge.CountAllEdgescounts all edges.CountAllVerticescounts all vertices.EdgeWeightgets the weight of an edge.Indegreereturns the indegree of a vertex.IsEdgereturns whether an edge exists.IsSimplereturns whether a graph is simple.IterAllEdgesiterates over all unweighted edges.IterAllWeightedEdgesiterates over all weighted edges.IterEdgesiterates over all unweighted edges of a source vertex.IterVerticesiterates over all vertices.IterWeightedEdgesiterates over all weighted edges of a source vertex.Outdegreereturns the outdegree of a vertex.RemoveEdgeremoves an edge.
Representations: repr
Adjacency list, unweighted
Vec<Vec<usize>>Vec<HashSet<usize>>[Vec<usize>][HashSet<usize>][Vec<usize>; V][HashSet<usize>; V]HashMap<usize, Vec<usize>>HashMap<usize, HashSet<usize>>
Adjacency list, weighted
Vec<Vec<(usize, W)>>Vec<HashSet<(usize, W)>>Vec<HashMap<usize, W>>[Vec<(usize, W)>][HashSet<(usize, W)>][HashMap<usize, W>][Vec<(usize, W)>; V][HashSet<(usize, W)>; V][HashMap<usize, W>; V]HashMap<usize, Vec<(usize, W)>>HashMap<usize, HashSet<(usize, W)>>HashMap<usize, HashMap<usize, W>>
Adjacency matrix, unweighted
AdjacencyMatrix: an adjacency matrix representation of an unweighted directed graph stored as a bit array.
Edge list, unweighted
Vec<(usize, usize)>[(usize, usize)][(usize, usize); V]HashSet<(usize, usize)>
Edge list, weighted
Vec<(usize, usize, W)>[(usize, usize, W)][(usize, usize, W); V]HashSet<(usize, usize, W)>