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

Terminate BFSShortestPath#getPath when target vertex is found #1225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pratyushgoyal66
Copy link

Fixes #1158.

Overloaded the BFSShortestPath#getPaths function to accept target vertex. Added logic to terminate the loop if target vertex is found. No extra test cases added as BFSShortestPath#getPath test case was already present in BFSShortestPathTest.java. I could see improvement of 43 times in the benchmarking tests for BFSShortestPath#getPath.


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

Successfully merging this pull request may close these issues.

Terminate BFSShortestPath#getPath early
1 participant