Graaf

Functions and types for working with graphs
Graaf is Dutch for
- graph
- count
- dig
This crate is in early alpha. The API is unstable.
Algorithms
Breadth-first search
algo::bfs::min_distances_single_sourcealgo::bfs::min_distancesalgo::bfs::predecessors_single_sourcealgo::bfs::predecessors
Dijkstra's algorithm
algo::dijkstra::min_distances_single_sourcealgo::dijkstra::min_distancesalgo::dijkstra::predecessors_single_sourcealgo::dijkstra::predecessors
Graph operation traits
These traits are implemented for various graph representations built from standard library containers.
op::AddEdgeadds an edge to an unweighted graph.op::AddWeightedEdgeadds an edge to a weighted graph.op::CountAllEdgescounts all edges in a graph.op::CountAllVerticescounts all vertices in a graph.op::EdgeWeightgets the weight of an edge.op::Indegreereturns the indegree of a vertex.op::IsEdgereturns whether an edge exists between two vertices.op::IterAllEdgesiterates over all unweighted edges in a graph.op::IterAllWeightedEdgesiterates over all weighted edges in a graph.op::IterEdgesiterates over all unweighted edges of a source vertex.op::IterVerticesiterates over all vertices in a graph.op::IterWeightedEdgesiterates over all weighted edges of a source vertex.op::Outdegreereturns the outdegree of a vertex.op::RemoveEdgeremoves an edge from a graph.
Graph representations
Adjacency list
Unweighted
Vec<Vec<usize>>Vec<HashSet<usize>>[Vec<usize>][HashSet<usize>]HashMap<usize, Vec<usize>>HashMap<usize, HashSet<usize>>
Weighted
Vec<Vec<(usize, W)>>Vec<HashSet<(usize, W)>>Vec<HashMap<usize, W>>[Vec<(usize, W)>][HashSet<(usize, W)>][HashMap<usize, W>]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)]HashSet<(usize, usize)>
Weighted
Vec<(usize, usize, W)>[(usize, usize, W)]HashSet<(usize, usize, W)>