Graaf

WARNING: this crate is pre-alpha
Functions and types for working with graphs
This crate builds on nightly. This will change in version 1.0.0.
Algorithms
algo::bfs::min_distances_single_sourcecalculates the minimum distances from the source verticex to all vertices.algo::bfs::min_distancescalculates the minimum distances from multiple source vertices to all vertices.algo::dijkstra::unweighted::min_distances_single_sourcecalculates the minimum distances from the source vertex to all vertices.algo::dijkstra::unweighted::min_distancescalculates the minimum distances from multiple source vertices to all vertices.algo::dijkstra::unweighted::shortest_pathscalculates the shortest paths from multiple source vertices to all vertices.algo::dijkstra::weighted::min_distances_single_sourcecalculates the minimum distances from the source vertex to all vertices.algo::dijkstra::weighted::min_distancescalculates the minimum distances from multiple source vertices to all vertices.
Graph operation traits
These traits are implemented for various graph representations built from standard library containers.
AddEdgeadds an edge to an unweighted graph.AddWeightedEdgeadds an edge to a weighted graph.CountAllEdgescounts all edges in a graph.CountAllVerticescounts all vertices in a graph.EdgeWeightgets the weight of an edge.Indegreereturns the indegree of a vertex.IsEdgereturns whether an edge exists between two vertices.IterAllEdgesiterates over all unweighted edges in a graph.IterAllWeightedEdgesiterates over all weighted edges in a graph.IterEdgesiterates over all unweighted edges of a source vertex.IterVerticesiterates over all vertices in a graph.IterWeightedEdgesiterates over all weighted edges of a source vertex.Outdegreereturns the outdegree of a vertex.RemoveEdgeremoves an edge from a graph.VertexWeightreturns the weight of a vertex.
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)>