shortestPaths<T extends Object> function

Map<T, Iterable<T>> shortestPaths<T extends Object>(
  1. T start,
  2. Iterable<T> edges(
    1. T
    ), {
  3. bool equals(
    1. T,
    2. T
    )?,
  4. int hashCode(
    1. T
    )?,
})

Returns a Map of the shortest paths from start to all of the nodes in the directed graph defined by edges.

All return values will contain the key start with an empty List value.

start and all values returned by edges must not be null. If asserts are enabled, an AssertionError is raised if these conditions are not met. If asserts are not enabled, violations result in undefined behavior.

If equals is provided, it is used to compare nodes in the graph. If equals is omitted, the node's own Object.== is used instead.

Similarly, if hashCode is provided, it is used to produce a hash value for nodes to efficiently calculate the return value. If it is omitted, the key's own Object.hashCode is used.

If you supply one of equals or hashCode, you should generally also to supply the other.

Implementation

Map<T, Iterable<T>> shortestPaths<T extends Object>(
  T start,
  Iterable<T> Function(T) edges, {
  bool Function(T, T)? equals,
  int Function(T)? hashCode,
}) =>
    _shortestPaths<T>(
      start,
      edges,
      equals: equals,
      hashCode: hashCode,
    );