Algorithm
- Start off with initial node
- Consider all the edges that leave that node, in some order
- Follow the first edge, and check to see if at goal node
- If not, repeat the process from new node
- Continue until either find goal node, or run out of options
- When run out of options, backtrack to the previous node and try the next edge, repeating this process
Example code