AdjacencyListGraph<E>.fromEdges constructor

AdjacencyListGraph<E>.fromEdges(
  1. Iterable<Edge<E>> edges, {
  2. bool directed = true,
})

Creates an adjacency list graph from edges.

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.fromEdges(
  Iterable<Edge<E>> edges, {
  bool directed = true,
}) {
  final graph = AdjacencyListGraph<E>(directed: directed);
  graph.addEdges(edges);
  return graph;
}