I'm new to Scheme, have been using MIT Scheme for sometime now. I'm trying to understand how to implement popular graph algorithms like the shortest path algorithms, BFS, DFS. Are there any tutorials that could help me out understand the recursion that'd be involved, along with the appropriate data structures? I have tried Googling my way around, but that didn't end up giving me good results.
EDIT: I apologize for not being more specific earlier. My question was pertaining to traversing the whole graph, and not finding the path between a start and goal node. So, given a graph G(V, E), where V is the vertex set and E is the edge set, starting from any node n, what is the path generated so that at the end of this traversal, all nodes are visited.
Most implementations that I found while Googling were the ones with the start and goal node. My version (one of the answers), chooses one vertex, and visits all others.
Take for example, the following graph:-
1 ----> 2 5
/| /|
/ | / |
/ | / |
/ | / |
/ | / |
4<----3 <---6 7
This DAG has (4->2), (2->3), (5->6) and (5->7), which I unable to represent in the diagram. :-)
The Path traversed starting from 1 could be:
(1, 2, 3, 4, 5, 6, 7)