Code Problem

Apr 1, 2016 at 2:50pm
here
Last edited on Apr 5, 2016 at 1:45pm
Apr 1, 2016 at 6:26pm
For BFS i am getting 1,2,4,5,7,6 Should i be getting 1,2,3,4,5,6?

When creating the edge list, you insert the nodes at the front of the list, so the list for node 1 is 2,4,3 instead of 3,4,2. That's why the results are the way they are.
Apr 1, 2016 at 6:33pm
You push nodes at the front of the adjacency list, so the list for node 1 is 2,4,3, not 3,4,2. That's why your results aren't what you expect.
Last edited on Apr 1, 2016 at 6:33pm
Topic archived. No new replies allowed.