Upcoming SlideShare
×

2,283 views
2,053 views

Published on

Demonstration of Breadth First Search Algorithm by an example

1 Comment
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• il ya une autre methhode utilisant un tableau d'OUVERT et de FERME j'aimerais bien avoir une idée sur cette methode si possible.

Are you sure you want to  Yes  No
Views
Total views
2,283
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
87
1
Likes
1
Embeds 0
No embeds

No notes for slide

1. 1. Breadth First Search Algorithm: Example v 1 BFS Tree: T = {} v 2 v 3 v 6 v 5 v 4 v 7 v 1 Layers: L0={} i=0
2. 2. Breadth First Search Algorithm: Example v 1 BFS Tree: T = {} v 2 v 3 v 6 v 5 v 4 v 7 v 1 Layers: L0={v1}}, i=1
3. 3. Breadth First Search Algorithm: Example v 1 BFS Tree: T = {(1,4),(1,5),} v 2 v 3 v 6 v 5 v 4 v 7 v 1 Layers: L0={v1}, L1={v4,v5}, i=1
4. 4. Breadth First Search Algorithm: Example v 1 BFS Tree: T = {(1,4), (1,5), (4,3), (5,2),(5,6),(5,7) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Layers: L0={v1}, L1={v4,v5}, L2={v3,v2,v6,v7} i=2
5. 5. Breadth First Search Algorithm: Example BFS Tree: T = {(1,4), (1,5), (4,3), (5,2),(5,6),(5,7) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Layers: L0={v1}, L1={v4,v5}, L2={v3,v2,v6,v7} i=2
6. 7. Depth First Search Algorithm: Example v 1 DFS Tree: T= {} v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v1}
7. 8. Depth First Search Algorithm: Example v 1 DFS Discovered Order: T= {v1,} v 2 v 3 v 6 v 5 v 4 v 7 Stack: {v4,v5}
8. 9. Depth First Search Algorithm: Example v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v3,v6,v7} DFS Discovered Order: T= {v1,v5}
9. 10. Depth First Search Algorithm: Example v 1 DFS Discovered Order: T= {v1,v5} v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v3,v6,v7}
10. 11. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v3,v6}
11. 12. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v3,v2}
12. 13. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v3}
13. 14. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2,v4}
14. 15. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4,v2}
15. 16. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {v4}
16. 17. Depth First Search Algorithm: Example v 1 DFS Tree: T= { (v1,v5) } v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {}
17. 18. Depth First Search Algorithm: Example DFS Tree: T= { (v1,v5) } v 1 v 2 v 3 v 6 v 5 v 4 v 7 v 1 Stack: {}