I am new to Scheme, now using MIT Scheme. I am trying to understand how to implement popular graph algorithms, such as shortest path algorithms, BFS, DFS. Are there any tutorials that can help me understand the recursion that will be involved, as well as the corresponding data structures? I tried googling my way, but it did not give me good results.
EDIT . I apologize for not being more specific before. My question was about going through the whole graph, not finding the path between the start and the target of the node. So, given the graph G (V, E), where V is the set of vertices, and E is the set of edges, starting from any node n, what is the path generated so that at the end of this tour all nodes are visited.
Most of the implementations that I found during Googling were those who had the beginning and purpose of the node. My version (one of the answers) selects one vertex and visits all the 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 cannot represent in the diagram. :-)
The path traveled from 1 can be:
(1, 2, 3, 4, 5, 6, 7)
source share