0% found this document useful (0 votes)
63 views50 pages

A B D C: Front

The document describes the process of performing a breadth-first search on a graph using a FIFO queue. It shows the graph being traversed level-by-level with nodes being added to the queue after their neighbors are discovered and then removed from the queue in FIFO order to be processed. The search continues, discovering new nodes and processing existing nodes, until the queue is empty, indicating all nodes at the current level have been processed.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views50 pages

A B D C: Front

The document describes the process of performing a breadth-first search on a graph using a FIFO queue. It shows the graph being traversed level-by-level with nodes being added to the queue after their neighbors are discovered and then removed from the queue in FIFO order to be processed. The search continues, discovering new nodes and processing existing nodes, until the queue is empty, indicating all nodes at the current level have been processed.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 50

Breadth First Search

A B C D

front

FIFO Queue

Breadth First Search


A B C D

enqueue source node

front

A
FIFO Queue

Breadth First Search


A B C D

dequeue next vertex

front

A
FIFO Queue

Breadth First Search


A B C D

visit neighbors of A

front

FIFO Queue

Breadth First Search


A B C D

visit neighbors of A

front

FIFO Queue

Breadth First Search


A

A
B C D

B discovered

front

B
FIFO Queue

Breadth First Search


A

A
B C D

visit neighbors of A

front

B
FIFO Queue

Breadth First Search


A

A
B C D

I discovered

front

B I
FIFO Queue

Breadth First Search


A

A
B C D

finished with A

front

B I
FIFO Queue

Breadth First Search


A

A
B C D

dequeue next vertex

front

B I
FIFO Queue

Breadth First Search


A

A
B C D

visit neighbors of B

front

I
FIFO Queue

Breadth First Search


A

A
B C D

visit neighbors of B

front

I
FIFO Queue

Breadth First Search


A

A
B C D

B
I

F discovered

front

I F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

visit neighbors of B

front

I F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

A already discovered

front

I F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

finished with B

front

I F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

dequeue next vertex

front

I F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

visit neighbors of I

front

F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

visit neighbors of I

front

F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

A already discovered

front

F
FIFO Queue

Breadth First Search


A

A
B C D

B
I

visit neighbors of I

front

F
FIFO Queue

Breadth First Search


A

A
B C D

I
I

E discovered

front

F E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

visit neighbors of I

front

F E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

F already discovered

front

F E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

I finished

front

F E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

dequeue next vertex

front

F E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

visit neighbors of F

front

E
FIFO Queue

Breadth First Search


A

A
B C D

I
I

G discovered

front

E G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

F finished

front

E G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

dequeue next vertex

front

E G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

visit neighbors of E

front

G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

E finished

front

G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

dequeue next vertex

front

G
FIFO Queue

Breadth First Search


A

A
B C D

I
I

visit neighbors of G

front

FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

C discovered

front

C
FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

visit neighbors of G

front

C
FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

H discovered

front

C H
FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

G finished

front

C H
FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

dequeue next vertex

front

C H
FIFO Queue

Breadth First Search


A

A
B

G
C D

I
I

visit neighbors of C

front

H
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

D discovered

front

H D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

C finished

front

H D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

get next vertex

front

H D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

visit neighbors of H

front

D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

finished H

front

D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

dequeue next vertex

front

D
FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

visit neighbors of D

front

FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

D finished

front

FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

dequeue next vertex

front

FIFO Queue

Breadth First Search


A

A
B

G
C

C
D

I
I

STOP

front

FIFO Queue

You might also like