Breadth First Search Animat Ion
Breadth First Search Animat Ion
2 4 8
1 1 5 7
pred(1) =all
Unmark 0
nodes in N; 3 6 9
next := 1
Mark node
order(1) = next
s
LIST:= {1}
LIST 1
next 1
Breadth first search animat 2
Select a node i in LIST
2 4 8
1 1 5 7
In breadth
first search, i 3 6 9
is the first
node in LIST
LIST 1
next 1
Breadth first search animat 3
If node i is incident to an admissible arc…
2 2 4 8
1 1 5 7
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j)
add j to LIST
LIST 1 2
next 2
1
Breadth first search animat 4
If node i is incident to an admissible arc…
2 2 4 8
1 1 5 7
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j)
add j to LIST
LIST 1 2 5
next 3
2
Breadth first search animat 5
If node i is incident to an admissible arc…
2 2 4 8
1 1 5 7
3
Next :=Node
Select
Mark an j
Next + 1 9
admissible 3 6
pred(j) := i 4
arc (i,j):= next
order(j)
add j to LIST
LIST 1 2 5 3
next 3
2
4
Breadth first search animat 6
If node i is not incident to an admissible arc…
2 2 4 8
1 1 5 7
3
Delete node i 3 6 9
from LIST 4
LIST 1 2 5 3
next 3
2
4
Breadth first search animat 7
Select Node i
2 2 4 8
1 1 5 7
3
LIST 1 2 5 3
next 3
2
4
Breadth first search animat 8
If node i is incident to an admissible arc…
2 2 5
4 8
1 1 5 7
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j) 4
add j to LIST
LIST 1 2 5 3 4
next 3
2
4
5
Breadth first search animat 9
If node i is not incident to an admissible arc…
2 2 5
4 8
1 1 5 7
3
Delete node i
from LIST 3 6 9
4
LIST 1 2 5 3 4
next 3
2
4
5
Breadth first search animat 10
Select a node
2 2 5
4 8
1 1 5 7
3
The first node
on LIST 3 6 9
becomes 4
node i
LIST 1 2 5 3 4
next 3
2
4
5
Breadth first search animat 11
If node i is incident to an admissible arc…
2 2 5
4 8
1 1 5 7
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j) 4 6
add j to LIST
LIST 1 2 5 3 4 6
next 3
2
4
5
6
Breadth first search animat 12
If node i is not incident to an admissible arc…
2 2 5
4 8
1 1 5 7
3
Delete node i
from LIST 3 6 9
4 6
LIST 1 2 5 3 4 6
next 3
2
4
5
6
Breadth first search animat 13
Select node 3
2 2 5
4 8
1 1 5 7
3
node
delete3node
is not3
incident
from LIST to 3 6 9
any 4 6
admissible
arcs
LIST 1 2 5 3 4 6
next 3
2
4
5
6
Breadth first search animat 14
Select a node
2 2 5
4 8
1 1 5 7
3
i:=4
3 6 9
4 6
LIST 1 2 5 3 4 6
next 3
2
4
5
6
Breadth first search animat 15
If node i is incident to an admissible arc…
2 2 5
4 87
1 1 5 7
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j) 4 6
add j to LIST
LIST 1 2 5 3 4 6 8
next 3
2
4
5
6
7
Breadth first search animat 16
If node i is not incident to an admissible arc…
2 2 5
4 87
1 1 5 7
3
Delete node i
from LIST 3 6 9
4 6
LIST 1 2 5 3 4 6 8
next 3
2
4
5
6
7
Breadth first search animat 17
Select node i
2 2 5
4 87
1 1 5 7
3
i := 6
3 6 9
4 6
LIST 1 2 5 3 4 6 8
next 3
2
4
5
6
7
Breadth first search animat 18
If node i is incident to an admissible arc…
2 2 5
4 87
1 1 5 7 8
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j) 4 6
add j to LIST
LIST 1 2 5 3 4 6 8 7
next 3
2
4
5
6
7
8
Breadth first search animat 19
If node i is incident to an admissible arc…
2 2 5
4 87
1 1 5 7 8
3
Next :=Node
Select
Mark an j
Next + 1
admissible 9
pred(j) := i 3 6
arc (i,j):= next
order(j) 4 6 9
add j to LIST
LIST 1 2 5 3 4 6 8 7 9
next 3
2
4
5
6
7
8
9
Breadth first search animat 20
If node i is not incident to an admissible arc…
2 2 5
4 87
1 1 5 7 8
3
Delete node i
from LIST 3 6 9
4 6 9
LIST 1 2 5 3 4 6 8 7 9
next 3
2
4
5
6
7
8
9
Breadth first search animat 21
Select node 8
2 2 5
4 87
1 1 5 7 8
3
node 8 is not
incident to an 3 6 9
admissible 4 6 9
arc; delete it
from LIST
LIST 1 2 5 3 4 6 8 7 9
next 3
2
4
5
6
7
8
9
Breadth first search animat 22
Select node 7
2 2 5
4 87
1 1 5 7 8
3
node 7 is not
incident to an 3 6 9
admissible 4 6 9
arc; delete it
from LIST
LIST 1 2 5 3 4 6 8 7 9
next 3
2
4
5
6
7
8
9
Breadth first search animat 23
Select node 9
2 2 5
4 87
1 1 5 7 8
3
node 9 is not
incident to an 3 6 9
admissible 4 6 9
arc; delete it
from LIST
LIST 1 2 5 3 4 6 8 7 9
next 3
2
4
5
6
7
8
9
Breadth first search animat 24
THE END