DirectedGraph<T> constructor

DirectedGraph<T>(
  1. Map<Vertex<T>, List<Vertex<T>>> edges,
  2. {Comparator<Vertex<T>> comparator}
)

Constructs a directed graph. edges is of type Map<Vertex<T>, List<Vertex<T>>>, mapping each vertex to a list of connected vertices.

Implementation

DirectedGraph(
  Map<Vertex<T>, List<Vertex<T>>> edges, {
  Comparator<Vertex<T>> comparator,
})  : _edges = edges ?? {},
      _comparator = comparator {
  _inDegreeMap = _createInDegreeMap();
  _vertices = MutableLazy<UnmodifiableListView<Vertex<T>>>(_sortedVertices);
}