Walkable<E>.from constructor

const Walkable<E>.from(
  1. Map<E, Iterable<E>> edges
)

Creates a walkable from a map of source nodes to target nodes.

The resulting walkable is lazy, and is generally inefficient for operations outside of iterating edges. This is a convenience method for creating a walkable from a collection of edges, i.e. in a test case.

Example

final walkable = Walkable.from({
  'a': ['b'],
  'b': ['c'],
  'c': ['d'],
});
print(walkable.edges); // {a -> b, b -> c, c -> d}

Implementation

const factory Walkable.from(
  Map<E, Iterable<E>> edges,
) = _EdgesWalkable<E>;