graph library

Graph-theory objects and algorithms.

Classes

AStarSearchIterable<V>
A-Star search algorithm.
BreadthFirstIterable<V>
Iterable over the breadth-first traversal of vertices.
DepthFirstIterable<V>
Iterable over the depth-first traversal of vertices. The vertices are emitted pre-order, that is right when they are first discovered.
DepthFirstPostOrderIterable<V>
Iterable over the post-order depth-first traversal of vertices. The vertices are emitted post-order, that is after all its descendants have been discovered.
DijkstraSearchIterable<V>
Dijkstra's search algorithm.
DinicMaxFlow<V>
Dinic max flow algorithm in O(V^2*E).
Edge<V, E>
An edge withing a graph connects a source and a target vertex.
ForwardingGraph<V, E>
Graph that forwards to a delegate implementation.
Graph<V, E>
Abstract base class of graphs.
GraphFactory<V, E>
Factory methods to create common graphs types efficiently.
Path<V, E>
A path withing a graph connects a series of vertices through their respective edges and values.
RandomWalkIterable<V>
Iterable producing a random walk over a graph.
StoerWagnerMinCut<V, E>
Stoer–Wagner minimum cut algorithm in O(VE + Vlog(V)).
StorageStrategy<T>
Encapsulates data structures used for the various graph algorithms.
TopologicalIterable<V>
Iterable over the topological sorting of vertices. This traversal requires a predecessor-function, and ignores nodes that are part of cycles.

Functions

kruskalSpanningTree<V, E>(Graph<V, E> graph, {required num edgeWeight(V source, V target), required Comparator<num> weightComparator, required StorageStrategy<V> vertexStrategy}) Graph<V, E>
Kruskal's algorithm to find the spanning tree in O(E*log(E)).
primSpanningTree<V, E>(Graph<V, E> graph, {required V? startVertex, required num edgeWeight(V source, V target), required Comparator<num> weightComparator, required StorageStrategy<V> vertexStrategy}) Graph<V, E>
Prim's algorithm to find the spanning tree in O(E*log(V)).

Exceptions / Errors

GraphError
Error thrown when encountering unexpected graph types.