firstShortestPath method

List<Node<T>> firstShortestPath()

Returns the first shortest path.

Implementation

List<Node<T>> firstShortestPath() {
  if (isEmpty) return [];

  return reduce(
      (shortest, path) => path.length < shortest.length ? path : shortest);
}