Finding all the shortest paths between two nodes in unweighted undirected graph
As a caveat, remember that there can be exponentially many shortest paths between two nodes in a graph. Any algorithm for this will potentially take exponential time. That said, there are a few relatively straightforward algorithms that can find all the paths. Here’s two. BFS + Reverse DFS When running a breadth-first search over a … Read more