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

Added Breadth-First Search [Python] #539

Merged
merged 3 commits into from
Jan 6, 2018
Merged

Added Breadth-First Search [Python] #539

merged 3 commits into from
Jan 6, 2018

Conversation

SteadBytes
Copy link
Contributor

Fixes #27

By submitting this pull request I confirm I've read and complied with the below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous time span of 7 days.

@singhpratyush
Copy link
Member

Hi! Thanks for showing interest in contributing to this repository.

Please make sure that you have ticked the points mentioned in PR description correctly.

Thanks again!

from collections import deque


def breadth_first_search(graph, source):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteadBytes: The breadth first search algorithm should be used for searching the path from one node to another in the graph in a breadth first manner.

In this implementation, you are trying to list out the breadth first traversal path, while you should be searching for a node.

Please let me know if something is wrong with this explanation.

Copy link
Contributor Author

@SteadBytes SteadBytes Jan 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singhpratyush That is a very good point! I guess I was trying to show how a breadth first search would traverse the structure during the search - which makes this a breadth first traversal algorithm as apposed to search.

It will be easy enough to fix though, should I fix and make a new PR or just udpate this one? 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this one itself. Thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will do, I just noticed there is a directory for depth_first_traversal, I could move this algorithm into a breadth_first_traversal directory and then make the changes to this for breadth_first_search.

Would that be ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding breadth first traversal can go to another PR. Or you can close this PR, create another PR with different change in README and make it as breadth first traversal.

I prefer the first option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good, I will do that - thanks a lot :)

@iiitv iiitv deleted a comment Jan 6, 2018
@singhpratyush singhpratyush merged commit 9fa59b9 into iiitv:master Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breadth First Search in a Graph [Python]
3 participants