Presentation is loading. Please wait.

Presentation is loading. Please wait.

GRAPH TRAVERSING BY PROF. UZAIR SALMAN

Similar presentations


Presentation on theme: "GRAPH TRAVERSING BY PROF. UZAIR SALMAN"— Presentation transcript:

1 GRAPH TRAVERSING BY PROF. UZAIR SALMAN
BREADTH FIRST SEARCH GRAPH TRAVERSING BY PROF. UZAIR SALMAN

2 BFS: Consider following Graph
ENQUE() B D DEQUE() A C E G F

3 DFS: Consider following Graph
ENQUE() B D DEQUE() CURRENT A C E OUTPUT: A G F

4 DFS: Consider following Graph
ENQUE() B D B DEQUE() CURRENT A C E OUTPUT: A B G F

5 DFS: Consider following Graph
ENQUE() B D G B DEQUE() CURRENT A C E OUTPUT: A B G G F

6 DFS: Consider following Graph
CURRENT ENQUE() B D G B DEQUE() A C E OUTPUT: A B G G F

7 DFS: Consider following Graph
ENQUE() B D G DEQUE() A C E OUTPUT: A B G G F CURRENT

8 DFS: Consider following Graph
ENQUE() B D C DEQUE() A C E OUTPUT: A B G C G F CURRENT

9 DFS: Consider following Graph
ENQUE() B D F C DEQUE() A C E OUTPUT: A B G C F G F CURRENT

10 DFS: Consider following Graph
ENQUE() B D F C DEQUE() CURRENT A C E OUTPUT: A B G C F G F

11 DFS: Consider following Graph
ENQUE() B D D F DEQUE() CURRENT A C E OUTPUT: A B G C F D G F

12 DFS: Consider following Graph
ENQUE() B D E D F DEQUE() CURRENT A C E OUTPUT: A B G C F D E G F

13 DFS: Consider following Graph
ENQUE() B D E D F DEQUE() A C E OUTPUT: A B G C F D E CURRENT G F

14 DFS: Consider following Graph
CURRENT ENQUE() B D E D DEQUE() A C E OUTPUT: A B G C F D E G F

15 DFS: Consider following Graph
ENQUE() B D E DEQUE() CURRENT A C E OUTPUT: A B G C F D E G F

16 DFS: Consider following Graph
ENQUE() B D QUEUE EMPTY DEQUE() A C E OUTPUT: A B G C F D E G F


Download ppt "GRAPH TRAVERSING BY PROF. UZAIR SALMAN"

Similar presentations


Ads by Google