AdjacencyListGraph<E> constructor

AdjacencyListGraph<E>({
  1. bool directed = true,
})

Creates an empty adjacency list graph.

If directed is true, which is the default, the graph is directed, i.e. an edge has an explicit source and a target node. If directed is false, the graph is undirected, and the inverse of an edge is also an edge.

Implementation

factory AdjacencyListGraph({bool directed = true}) {
  return directed
      ? _AdjacencyListGraph<E>()
      : _UndirectedAdjacencyListGraph<E>();
}