Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bfs.lua not correct on starting node other than 1 #2

Open
nczempin opened this issue May 19, 2016 · 0 comments
Open

bfs.lua not correct on starting node other than 1 #2

nczempin opened this issue May 19, 2016 · 0 comments

Comments

@nczempin
Copy link

nczempin commented May 19, 2016

I tried your bfs.lua code (it is high on google search for "bfs lua"). however, I'm not sure if it is entirely correct. While your test gives the expected result when the starting node is 1, just using a random other starting node doesn't give me the expected results:
Replacing 1 by 7 in your test case, I get this output
7, 4, 11, 12, 7, 8, 7, 7, 11, 12, 11, 12, 11, 12
Nodes missing (anything smaller than 7 it seems), many being duplicated; pretty sure this is not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant