findPathFromPairsList static method

List findPathFromPairsList(
  1. List<List> list,
  2. dynamic start,
  3. dynamic end
)

Return the shortest path

If have not the path, return empty list;

List like: [0, 2, 3, 4, 0, 6, 5, 6, 2, 3, 0, 1, 0, 4, 0, 113, 113, 114, 111, 112]

Implementation

static List findPathFromPairsList(
    List<List> list, dynamic start, dynamic end) {
  var graph = pairsListToGraphMap(list);
  var predecessors = singleSourceShortestPaths(graph, start, end);

  return extractShortestPathFromPredecessorList(predecessors, end);
}