Graaf
Functions and types for working with graphs
WARNING: this crate is pre-alpha
Algorithms
Single-source shortest paths
dijkstra_sssp_unweightedfor unweighted directed graphsdijkstra_sssp_weightedfor weighted directed graphs
Multiple sources shortest paths
Unweighted.dijkstrafor unweighted directed graphsWeighted.dijkstrafor weighted directed graphs
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 a given edge.Indegreereturns the indegree of a given 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 with a given source vertex.IterVerticesiterates over all vertices in a graph.IterWeightedEdgesiterates over all weighted edges with a given source vertex.Outdegreereturns the outdegree of a vertex.RemoveEdgeremoves an edge from a graph.VertexWeightreturns the weight of a given vertex.
Graph representations
Adjacency list, unweighted
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)>