Graaf
Functions and types for working with graphs.
WARNING: this crate is pre-alpha
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.
Graph operation traits
AddEdgeadds an edge to an unweighted graphAddWeightedEdgeadds an edge to a weighted graphCountAllEdgescounts all edges in a graphCountAllVerticescounts all vertices in a graphEdgeWeightgets the weight of a given edgeIndegreereturns the indegree of a given vertexIsEdgereturns whether an edge exists between two verticesIterAllEdgesiterates over all unweighted edges in a graphIterAllWeightedEdgesiterates over all weighted edges in a graphIterEdgesiterates over all unweighted edges with a given source vertexIterVerticesiterates over all vertices in a graphIterWeightedEdgesiterates over all weighted edges with a given source vertexOutdegreereturns the outdegree of a vertexRemoveEdgeremoves an edge from a graphVertexWeightreturns the weight of a given vertex
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)>