Chapter
5
Solutions
5.1
The
Prim-Dijkstra
Algorithm
Arbitrarily
select node
e
as
the
initiaJ frag-
ment.
Arcs
are
added
in
the
following order:
(d,e), (b,d), (b,c)
{tie
with
(a,b)
is
broken arbitrarily},
(a,
b),
(a,
J).
Kruskal's
Algorithm
Start
with
each node as a fragment.
Arcs
are
added
in
the
following order: (a,f),
(b,d),
(a,b)
{tie
with (b,c)
is
broken arbitrarily},
(b,c), (d,e).
The
weight
of
the
MST
in
both
cases is 15.
5.2
The
Bellman-Ford
Algorithm
By convention,
D~h)
=
0,
for
aJI
h.
Initially
DP)
=
d
li
,
for all
i
:#
1.
For each successive
h
?:
1
we
compute
D~h+l)
=
minj[Djh)
+
d
ji
),
for all
i
:f
1.
The
results are summarized in
the
following
table.
D~
D
2
D3
D~
D~
Shortest
path
arcst
•
•
t
t
t
1
0
0
0
0
0
2
4
4
4
4
4
(1,2)
3
5
5
5
5
5
(1,3)
4
00
7
7
7
7
(2,4)
5
00
14
13
12
12
(6,5)
6
00
14
10
10
10
(4,6)
7
00
00
16
12
12
(6,7)
tThe
arcs on
the
shortest
path
tree
are computed
after
running
the
Bellman-
Ford aJgorithm. For each
i:f
1
we
include in
the
shortest
path
tree one
arc
U,i)
that
minimizes Bellman's equation.
Dijkstra's
Algorithm
Refer
to
the
algorithm description in
the
text.
Ini-
tially:
D
1
=
0;
D;
=
d
u
for
i
:f
1;
P
=
{l}.
The
state
after each
iteration
is