Tags

, ,

Recently, I was trying to implement an idea I had. The idea needed me to implement a Graph data structure. While implementing a Graph was very simple, I was stuck at another ‘simple’ task – that of finding all paths from the source to the destination.

Initially I searched on Google and found a few tips, but most of them referred to the shortest path from the source to the destination. After giving the algorithm a shot using recursion, I decided to search once again. Then I found the code by Robert Sedgewick, which did what I wanted. While going through my code, I realized that I was stuck at maintaining the backtracking information – which I had in my mind, but was not able to get working properly.

Advertisements