-
Notifications
You must be signed in to change notification settings - Fork 26
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
Bug in BFS? #2
Comments
Probably. I didn't finish building this out. |
Since you have helped me... I try to give back the favour...
} |
Thank you! Would you like to try your hand at forking the code, adding this and doing a pull request (PR)? |
Hello,
it seems that the procedure never enters in the "allowTraversal" function. Thus, it loops forever in case of graphs with cycles.
I don't know very well PowerShell, however from a first insight it is weird that the $seen variable is initialized every time allowTraversal is called.
I used this patch:
$graph.getNeighbors($currentVertex).ForEach{ $nextVertex = $_ if (!$seen[$nextVertex.getKey()]) { "NOT SEEN: " + $nextVertex.getKey() $seen[$nextVertex.getKey()] = $true $vertexQueue.enqueue($nextVertex) } }
Cheers
The text was updated successfully, but these errors were encountered: