-
Notifications
You must be signed in to change notification settings - Fork 271
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
Add breadth first search for graphs #82
Comments
hey ,can i work on this issue? |
Hi, You can work on the serial BFS. Feel free to start the work in a PR. May be we can create a new file, |
Hi @czgdp1807 I would, like to work on this issue. The API would simply take adjacency list as input and will return the bfs as output, as far as I understand? |
Feel free to work on the serial version of BFS. Use the |
IMO, BFS should be customized enough to perform some operations related to or on the Node we visit it. For example, if we want to check is there exists a path from the source node to the destination node then BFS should stop as soon as it encounters the destination node. Or may be just forming a BFS tree or storing the level of a node in the BFS tree. breadth_first_search(source_node, operation, *args, **kwargs)
|
This has given me the idea of adding |
Something better would be, breadth_first_search(graph, source_node, operation, *args, **kwargs) Inside the above function we can call the following for different implementations of graphs, getattr(module, "_breadth_first_search_" + implementation)(graph, source_node, operation, *args, **kwargs) The above will allow doing the stuff without modifying the definition of |
Below is the final API for BFS(both serial and parallel) which I have thought of, Serial Parallel
P.S. I will make a PR by tomorrow if no contributor is interested to implement the above APIs. |
Description of the problem
As graphs are now added to the
master
branch we can start adding graph algorithms. For a start we will move ahead with breadth first search(BFS). We look forward to add two versions of the algorithm,i. http://supertech.csail.mit.edu/papers/pbfs.pdf (not used in the implementation)
ii. https://people.eecs.berkeley.edu/~aydin/sc11_bfs.pdf (not used in the implementation)
Example of the problem
References/Other comments
The text was updated successfully, but these errors were encountered: