Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create breadth_first_search_exercise.md
  • Loading branch information
nikhilailani authored Dec 7, 2020
commit 87e7baa9148fa8c308ffd2b9f3b4d815d7b8496c
35 changes: 35 additions & 0 deletions 9_breadth_first_search/breadth_first_search_exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# BFS_Traversal
BFS Traversal of a graph in python using graph given in dictionary

Implement a program to find whether a path exists for an airline route or not. The routes are described using graph having nodes. The names of the graphs are named alphabet characters for easy understanding. Print the path if it exists; print the denying statement if it doesn't!

Example: A, B, C, D, E, F are the nodes of the graph.


For example, you are given following data:

```
Data = {'A': {'B'},
'B': {'A', 'C', 'D'},
'C': {'B', 'E'},
'D': {'B', 'E'},
'E': {'C', 'D', 'F'},
'F': {'E'}}
```

the resultant graph will be :-

![alt text](https://github.com/nikhilailani/BFS_Traversal/blob/main/DFS_BFS_Graph.png)


**Explanation:** Here, selecting A as source node and D as destination node, the values are passed to the function.

Your output should look like this:

'''
Path exists!
Path : A->B->D
'''

[Solution](https://github.com/nikhilailani/BFS_Traversal/blob/main/bfs_exercise_solution.py)