I'm unsure of how to deal with the input I've been provided for an assignment on Breadth First Search. We're suppose to traverse a graph and output the order of traversal. Here's a list of directed edges:
0 1
0 2
2 6
6 1
7 9
4 0
6 4
6 3
9 3
6 2
8 6
1 4
5 6
1 2
6 5
2 3
2 7
5 7
9 0
Traversal: 0 1 2 4 6 3 7 9 5
I'm not sure how to traverse it correctly? Once I get to Node 1 & 2 how do I get to the other Node 1's & 2's that are further down on the list?
I know I'll have to keep track of the nodes using separate lists (which is a separate issue) but
would it be best to order the list first?
Not really looking for code just a starting point but if you'd like to answer with a code example, circular linked list in C++ is what I have to work with.