findPathFromGraph static method
Return the shortest path
If have not the path, return empty list;
Graph like: {0: {2: 1, 6: 1, 1: 1, 4: 1, 113: 1}, 2: {0: 1, 3: 1}, 6: {0: 1, 5: 1}, 1: {0: 1}, 4: {0: 1, 3: 1}, 113: {0: 1, 114: 1}, 3: {2: 1, 4: 1}, 5: {6: 1}, 114: {113: 1}, 111: {112: 1}, 112: {111: 1}}
Implementation
static List findPathFromGraph(Map graph, dynamic start, dynamic end) {
var predecessors = singleSourceShortestPaths(graph, start, end);
return extractShortestPathFromPredecessorList(predecessors, end);
}