Breadth First Search Algorithm

  • 1,190 views
Uploaded on

Demonstration of Breadth First Search Algorithm by an example

Demonstration of Breadth First Search Algorithm by an example

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • 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
    Your message goes here
No Downloads

Views

Total Views
1,190
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
38
Comments
1
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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. 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. 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. 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. 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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}
  • 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: {}
  • 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: {}