Graaf
Functions and types for working with graphs.
WARNING: this crate is pre-alpha
Graph representations
Adjacency list
Vec<Vec<usize>>Vec<Vec<(usize, usize)>>Vec<HashSet<usize>>Vec<HashSet<usize, W>>Vec<HashMap<usize, W>>[Vec<usize>][Vec<(usize, usize)>][HashSet<usize>][HashSet<usize, W>][HashMap<usize, W>]HashMap<usize, Vec<usize>>HashMap<usize, Vec<(usize, W)>>HashMap<usize, HashSet<usize>>HashMap<usize, HashSet<(usize, W)>>HashMap<usize, HashMap<usize, W>>
Adjacency matrix
AdjacencyMatrix
An adjacency matrix representation of an unweighted directed graph stored as a bit array.
Edge list
Vec<(usize, usize)>Vec<(usize, usize, W)>[(usize, usize)][(usize, usize, W)]HashSet<(usize, usize)>HashSet<(usize, usize, W)>
Graph operation traits
AddEdgeadds an edge to an unweighted graphAddWeightedEdgeadds an edge to a weighted graphCountAllEdgescounts all the edges in a graphCountAllVerticescounts all the vertices in a graphEdgeWeightreturns the weight of an edgeIndegreereturns the indegree of an edgeIsEdgereturns whether an edge exists in a graphIterAllEdgesiterates over all the edges in an unweighted graphIterAllWeightedEdgesiterates over all the edges in a weighted graphIterEdgesiterates over all the edges from a vertex in an unweighted graphIterVerticesiterates over all the vertices in a graphIterWeightedEdgesiterates over all the edges from a vertex in a weighted graphOutdegreereturns the outdegree of an edgeRemoveEdgeremoves an edge from a graphVertexWeightreturns the weight of a vertex
Algorithms
Shortest path
DijkstraUnweighted
Dijkstra's algorithm with binary heap for unweighted directed graphs. Works on graph representations that implement AddEdge.
DijkstraWeighted
Dijkstra's algorithm with binary heap for weighted directed graphs. Works on graph representations that implement AddWeightedEdge.