0% found this document useful (0 votes)
17 views43 pages

Network 9

This document discusses the minimum cost spanning tree problem in graph theory. It provides three key results: 1) In a minimum cost spanning tree, every edge connecting two partitions of the graph (an in-tree edge) must be the minimum cost edge between those partitions. 2) In a minimum cost spanning tree, every edge not in the tree (an out-of-tree edge) must be the maximum cost edge of the fundamental cycle it creates. 3) Any spanning tree satisfying these two properties is a minimum cost spanning tree. Therefore, finding a spanning tree that satisfies these optimality conditions solves the minimum cost spanning tree problem.

Uploaded by

Faiz Ramadhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views43 pages

Network 9

This document discusses the minimum cost spanning tree problem in graph theory. It provides three key results: 1) In a minimum cost spanning tree, every edge connecting two partitions of the graph (an in-tree edge) must be the minimum cost edge between those partitions. 2) In a minimum cost spanning tree, every edge not in the tree (an out-of-tree edge) must be the maximum cost edge of the fundamental cycle it creates. 3) Any spanning tree satisfying these two properties is a minimum cost spanning tree. Therefore, finding a spanning tree that satisfies these optimality conditions solves the minimum cost spanning tree problem.

Uploaded by

Faiz Ramadhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Contents

9 The Minimum Cost Spanning Tree Problem 628


9.1 Some Results on Minimum Cost Spanning Trees . . . . 631
9.2 Algorithms for the Minimum Cost Spanning Tree Problem635
9.3 An Algorithm for Ranking the Spanning Trees in As-
cending Order of Cost . . . . . . . . . . . . . . . . . . 645
9.4 Other Types of Minimum Cost Spanning Tree Problems 648
9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . 651
9.6 References . . . . . . . . . . . . . . . . . . . . . . . . . 664

i
ii
Chapter 9

The Minimum Cost


Spanning Tree Problem

Given a set of points on the two-dimensional plane, the problem of


finding the shortest connecting network that connects all the points,
using only lines joining pairs of points from the given set arises in many
applications. If the length between every pair of points is positive, the
shortest connecting network will obviously be a spanning tree, it will
be a minimum length spanning tree.
The minimum length (or cost) spanning tree problem is one of the
nicest and simplest problems in network optimization, and it has a
wide variety of applications. The input in this problem is a connected
undirected network G = (N , A) with c = (cij : (i; j) ∈ A) as the vector
of edge costs or lengths. Define the cost (or length) of a tree in G to
be the sum of the costs (or lengths) of edges in it. The problem is
to find a minimum cost (or length) spanning tree in G. Applications
include the design of various types of distribution networks in which the
nodes represent cities, centers etc.; and edges represent communication
links (fiber glass phone lines, data transmission lines, cable TV lines,
etc.), high voltage power transmission lines, natural gas or crude oil
pipelines, water pipelines, highways, etc. The objective is to design a
network that connects all the nodes using the minimum length of cable
or pipe or other resource. The minimum cost spanning tree problem
also appears as a subproblem in algorithms for many routing problems

628
629

Mackinaw City
3
Traverse City 105

4
170 210

140
Saginaw
2
135
5
Grand
Rapids
112
245 157 270
300
306 85 180

6 1
Benton Harbor Detroit
Figure 9.1:

such as the traveling salesman problem.


As an example consider the network G with 6 nodes representing
6 Michigan cities, and edges joining every pair of these nodes, given
in Figure 9.1. The number on each edge is its length in miles. The
minimum length spanning tree in this network is marked with thick
lines.
The network G may in fact be a directed or mixed network. The
problem that we consider in this chapter is that of finding a minimum
cost spanning tree in G without paying any regard to the orientations
of the arcs in G. So, if there are any arcs in the input network, we ignore
their orientations and treat every line as an edge. We also assume that
the network G has no self loops. If there are r parallel edges joining a
pair of nodes in G, any tree can contain at most one of them, and if
630 Ch. 9. Min. Cost Spanning Trees

3
2

2 3

2 4 4 4

5 2 4

Figure 9.2: The shortest path tree rooted at a node may not be a
minimum length spanning tree.

a minimum cost spanning tree contains any of them it will be a least


cost edge among them. So, we identify one least cost edge among these
r parallel edges and keep it, but delete all the rest. Hence, in the
sequel, we assume that there is at most one edge joining any pair of
nodes in the input network G = (N , A). Let |N | = n, |A| = m. So,
<
m = n(n − 1)/2 < n2 /2.
What we are considering is the unconstrained minimum cost
spanning tree problem. The constrained minimum cost span-
ning problem with constraints on the type of spanning tree obtained
is discussed briefly in Section 9.4.

A Method That Does Not Work

Let the input network be G = (N , A, c) with c > 0. Consider the


following approach. Select any node, say 1, and find the shortest paths
from it to all the other nodes in G. This yields a shortest path tree
0 rooted at 1. For every node j = 1, the path between 1 and j in
9.1. Some Results 631

0 is a shortest path between these nodes in G. Because of this one


may be tempted to conclude that 0 is a minimum length spanning
tree in G. This may not be the case as illustrated in Figure 9.2. Here
0 , consisting of the dashed arcs; has length 11. It is not a minimum
length spanning tree; since the spanning tree consisting of the thick
edges (dashed or continuous) has length only 9.

9.1 Some Results on Minimum Cost Span-


ning Trees
Let the input network be G = (N , A, c) with |N | = n. No assumptions
are made on the entries in c, each of them could be positive, 0, or
negative.

THEOREM 9.1 Let 0 be a minimum cost spanning tree in G. Then


every in-tree edge in 0 must be a minimum cost edge in the funda-
mental cutset associated with it.

Proof Let (X; X) be the fundamental cutset associated with the


in-tree edge (i; j) in 0 . So, (i; j) is the only in-tree edge in (X; X),
and deletion of (i; j) from 0 disconnects it into two smaller trees,
one spanning the nodes in X, and the other spanning the nodes in X.
Suppose a minimum cost edge in the cutset (X; X) is an out-of-tree
edge (p; q) and not (i; j), i.e., cpq < cij . Then replacing (i; j) in 0 by
(p; q) leads to a spanning tree 1 with cost = cost of 0 − (cij − cpq ) <
cost of 0 , contradicting the optimality of 0 . Hence (i; j) must be a
minimum cost edge in the fundamental cutset (X; X) associated with
it in 0 .

THEOREM 9.2 Let 0 be a minimum cost spanning tree in G. Then


every out-of-tree edge must be a maximum cost edge in the fundamental
cycle associated with it.

Proof Let (p; q) be an out-of-tree edge. If there is an in-tree edge


(i; j) on the fundamental cycle of (p; q) satisfying cpq < cij , replacing
(i; j) in 0 by (p; q) leads to a new spanning tree with cost = cost of
632 Ch. 9. Min. Cost Spanning Trees

0 + (cpq − cij ) < cost of 0 , contradicting the optimality of 0 . So,


>
cpq must be = the cost of every in-tree edge in the fundamental cycle
of (p; q).

THEOREM 9.3 Any spanning tree in G satisfying

Every out-of-tree edge has maximum


cost in its fundamental cycle wrt that (9.1)
tree.
is a minimum cost spanning tree.

Proof Let 1 , 2 be two distinct spanning trees in G satisfying


(9.1). We will now prove that the costs of 1 and 2 must be equal.
Classify the edges in 1 ∪ 2 into 3 classes. The 1 -edges are those
which are in 1 but not in 2 . The 2 -edges are those in 2 but not
in 1 . The 1 2 -edges are those which are in both 1 and 2 . Since
1 and 2 are distinct, both the sets of 1 −, 2 -edges are nonempty.
Select any 2 -edge, say (r; s). Let P1 be the unique path in 1
between r, s. Then CC1 = {(r; s)} ∪ P1 is the fundamental cycle of
(r; s) wrt 1 . All edges on P1 are in 1 , and at least one of them
is not in 2 , as otherwise 2 contains the entire simple cycle CC1 , a
contradiction since 2 is a tree. So, there are some 1 - edges on P1 .
Since 1 satisfies (9.1), all these 1 edges on P1 have cost coefficients
<
= crs .
Claim: At least one of the 1 -edges on P1 has cost coefficient = crs .
We will prove the claim by contradiction. Suppose each 1 -edge
on P1 has cost < crs . Let (p; q) be a 1 -edge on P1 . So, cpq < crs .
(p; q) is an out-of-tree edge for 2 , let Spq be the unique path between
p and q in 2 . Since 2 satisfies (9.1), each edge (i; j) on Spq satisfies
<
cij = cpq < crs . Hence Spq does not contain the edge (r; s). Replace the
1 -edge (p; q) on P1 by the path Spq , but continue denoting it by the
same symbol P1 . If there are other 1 -edges remaining on P1 , carry
out the same procedure for them. When this process is completed, the
path P1 gets converted into a path from r to s, not containing the edge
(r; s), but completely contained in 2 , call it P at this stage. So, 2
contains the edge (r; s) and the path P from r to s not containing the
9.1. Some Results 633

edge (r; s), a contradiction since 2 is a tree. So, the claim must be
true.
So, at least one of the 2 -edges on P1 has cost = crs , suppose it is
(j1 ; j2 ). Replace (j1 ; j2 ) from 1 by (r; s). This leads to a new spanning
tree 1 with the same cost as 1 , but it has one more edge in common
with 2 , and it can be verified that it also satisfies (9.1). If 1 and 2
are distinct, repeat this process again with them. After each repetition
we get another spanning tree satisfying (9.1) and having the same cost
as 1 , but containing one more edge in common with 2 . So, after at
most n − 1 repetitions of this process it must lead to 2 . Hence 1
and 2 have the same cost.
There are only a finite number of spanning trees in G, and hence
a minimum cost spanning tree exists in G. If 0 is a minimum cost
spanning tree, it satisfies (9.1) by Theorem 9.2. But we have just
proved that any pair of spanning trees satisfying (9.1) have the same
cost. Hence every spanning tree in G satisfying (9.1) is a minimum
cost spanning tree.

THEOREM 9.4 Let F be the set (possibly empty) of edges in a forest


in G. Let (X; X) be a cut in G containing none of the edges from
F. (p; q) is a minimum cost edge in the cut (X; X). Consider the
problem of finding a minimum cost tree among the spanning trees of G
containing all the edges in F. There is a minimum cost spanning tree
for this problem which contains the edge (p; q).

Proof Since G is connected and F is the set of edges in a forest,


there exist spanning trees of G which contain all the edges in F; let
0 be a minimum cost one among them. If 0 contains (p; q) we are
done. Suppose (p; q) ∈ 0 . Let CC be the fundamental cycle of (p; q)
wrt 0 . Since C C is a cycle and it contains the edge (p; q) from the cut
(X; X), it must contain at least another edge, say (r; s) from (X; X).
By the hypothesis (X; X) contains no edges from F, so (r; s) ∈ F and
<
since (p; q) is a minimum cost edge in (X; X), cpq = crs . Let 1 be
the spanning tree obtained by replacing (r; s) in 0 with (p; q). Since
(r; s) ∈ F, 1 contains all the edges in F, and also the edge (p; q).
If cpq < crs , the cost of 1 would be < cost of 0 , contradicting the
definition of 0 . So, cpq must equal crs , and 1 is also a minimum cost
634 Ch. 9. Min. Cost Spanning Trees

one among the spanning trees of G containing all the edges in F, and
it contains (p; q), proving the theorem.

COROLLARY 9.1 Let (p; q) be a minimum cost edge in a cut in G.


Then there is a minimum cost spanning tree containing (p; q).

Proof Follows from Theorem 9.4 with F = ∅.

COROLLARY 9.2 Suppose F ⊂ A satisfies the property that there


exists a minimum cost spanning tree in G containing all the edges in
F. Let (p; q) be a minimum cost edge in a cut in G which contains no
edges from F. Then, there exists a minimum cost spanning tree in G
containing all the edges in F∪{(p; q)}.

Proof Follows from Theorem 9.4.

THEOREM 9.5 Let F ⊂ A be the set of edges in a forest in a con-


nected undirected network G. Let C C be a simple cycle in G, and (r; s)
a maximum cost edge among those edges in CC not in F. Consider the
problem of finding a minimum cost spanning tree among those span-
ning trees of G containing all the edges in F. There is a minimum cost
spanning tree for this problem which does not contain (r; s).

Proof Let 0 be a minimum cost spanning tree in G among those


containing all the edges in F. If (r; s) ∈ 0 we are done. Suppose 0
contains (r; s). Let (X; X) be the fundamental cutset of (r; s) wrt 0 .
So, (r; s) is the only in-tree arc in (X; X), and hence this cut contains
no arcs from F. Since (X; X) contains (r; s) from CC, it must contain
at least one other edge from CC, suppose it is (p; q). So, (p; q) is an
>
out-of-tree edge on CC, and since (p; q) ∈ F we have crs = cpq . Let 1
be the spanning tree obtained by replacing (r; s) from 0 by (p; q). 1
contains all the edges in F and does not contain (r; s). If crs > cpq , cost
of 1 < cost of 0 , contradicting the definition of 0 . So, we must
have crs = cpq , and 1 is a minimum cost spanning tree among those
containing all the edges in F, and does not contain (r; s).

Exercises
9.2. Min. Spanning Tree Algorithms 635

9.1 Prove the following converse of Theorem 9.1. If is a spanning


tree in G satisfying

each edge in is a min. cost edge in its fundamental cutset wrt


(9.2)
then is a minimum cost spanning tree in G.

9.2 Let G = (N , A) be an undirected connected network with |N | =


n. With each spanning tree in G associate its 0-1 incidence vector
defined on A to be the vector (aij : (i; j) ∈ A) where aij = 1 if (i; j) is an
in-tree edge, 0 otherwise. Consider the following system of constraints
in variables (xij : (i; j) ∈ A)

( xij : over (i; j) ∈ A) =n−1


<
( xij : over (i; j) ∈ A; i, j ∈ J) = |J| − 1,
>
for all J ⊂ N with |J| = 2 (9.3)
>
xij = 0, for all (i; j) ∈ A
Prove that K, the set of feasible solutions of (9.3), is the convex hull
of the 0-1 incidence vectors of all the spanning trees in G. Also prove
that the 0-1 incidence vector of any spanning tree in G is an extreme
point of K and conversely.
Given two extreme points of K, derive necessary and sufficient con-
ditions for them to be adjacent, based on the properties of spanning
trees corresponding to them.

9.2 Algorithms for the Minimum Cost Span-


ning Tree Problem
All efficient algorithms known for this problem are based on an incre-
mental approach which builds up a minimum cost spanning tree, edge
636 Ch. 9. Min. Cost Spanning Trees

by edge, called the greedy method. It is so named because at each


stage it selects the next edge to be the cheapest that can be selected at
that time. The greedy method is very naive, once a decision to include
an edge is made, that decision is never reversed (so, no backtracking),
and the selection at each stage is based on the situation at that time
without any features of look-ahead etc. Hence, the method is also
known as a myopic method. The fact that such a simple approach
solves the minimum cost spanning tree problem indicates the very nice
structure and the simplicity of the problem.
All the algorithms begin with the trivial spanning forest in G con-
sisting of isolated nodes: ({1}, ∅), . . . , ({n}, ∅). In each step they
select one or more edges merging the forest components. Finally, af-
ter (n − 1) edges are selected, all the forest components merge into
a single spanning tree, which will be a minimum cost spanning tree.
We will denote the set of trees in the forest in a general stage by
F1 = (N1 , A1 ), . . . , Fl = (Nl , Al ), where each of F1 , . . . , Fl is a tree;
and N1 , . . . , Nl is a partition of N . F1 , . . . , Fl are the connected com-
ponents in the forest at this stage.
The first algorithm that we discuss is known as Prim’s algorithm
(Jarnik [1930], Prim [1957], Dijkstra [1959 of Chapter 4]). It grows
only one component in the forest as a connected tree, leaving all the
other components as isolated nodes. So, we will call the component
being grown as the “tree.” Select a node arbitrarily, say node 1, and
make it the root node of the tree. Since the network is undirected, we
maintain the predecessor indices of the nodes in the tree without any
+ or − signs. Nodes in the tree are labeled with predecessor indices,
which are called permanent labels. Each out-of-tree node j carries
a temporary label (which can change from step to step until this
node joins the tree) of the form (Pj , dj ), where dj = +∞ and Pj = ∅
if there is no edge joining j with an in-tree node so far; and dj = min.
{cij : over i an in-tree node such that (i; j) ∈ A } and Pj is an i that
attains this minimum, otherwise. So, for an out-of-tree node j with
temporary label (Pj , dj ), if dj < ∞, Pj is a “nearest” in-tree node to j
at this stage. We will now describe Prim’s algorithm.

PRIM’S ALGORITHM
9.2. Min. Spanning Tree Algorithms 637

Initialization Permanently label the root node 1 with the label ∅.


For each node j such that (1; j) ∈ A [(1; j) ∈ A] temporary label
j with (1, c1j ) [(∅, ∞)].

General step Among all out-of-tree nodes j at this stage, find one
with the smallest dj , suppose it is r with temporary label (Pr , dr ).
Delete this temporary label on r and give it the permanent label
Pr (its predecessor index in the tree), i.e., make (Pr , r) an in-tree
edge and r an in-tree node. If there are no out-of-tree nodes left,
terminate, the spanning tree defined by the permanent labels is
a minimum cost spanning tree in G. If there are some out-of-tree
nodes left update their temporary labels as follows: for each out-
of-tree node j with temporary label (Pj , dj ), change it to (r, crj )
only if (r; j) ∈ A and crj < dj ; leave it unchanged otherwise.
Then go to the next step.

Discussion

At some stage in the algorithm let X be the set of in-tree nodes


and X its complement. So, there are no in-tree edges in the cut (X;
X) at this stage. The edge selected at this stage for being the next
in-tree edge is a minimum cost edge in the cut (X, X) by the manner
in which it is selected. This is a greedy selection, that’s what makes
this a greedy method. Applying Corollaries 9.1, 9.2 in each step, we
conclude that at every stage there is a minimum cost spanning tree in
G containing all the in-tree edges at that stage. Hence when the tree
becomes a spanning tree in G, it is a minimum cost spanning tree in
G.
The computational effort in each step is clearly O(n) and there are
exactly n − 1 steps. Hence the overall computational complexity of this
algorithm is O(n2).
As an example we apply this algorithm on the network in Figure
9.1. We select node 1 as the root node. We show the node labels, and
the in-tree edge selected in each step in the following table. Permanent
labels are shown in bold face. Non-bold face labels are temporary.
638 Ch. 9. Min. Cost Spanning Trees

Step Label on node at end of step In-tree node


and in-tree edge
1 2 3 4 5 6 selected in step
Initial ∅ (1,112) (1,300) (1,270) (1,157) (1,195)
1 ∅ 1 (2,210) (2,170) (2,135) (2,180) 2, (1; 2)
2 ∅ 1 (5,206) (5,140) 2 (5,85) 5, (2; 5)
3 ∅ 1 (5,206) (5,140) 2 5 6, (5; 6)
4 ∅ 1 (4,105) 5 2 5 4, (5; 4)
5 ∅ 1 4 5 2 5 3, (4; 3)
n
There can be at most 2 edges in G, the network is dense if their
number is of this order. Since the cost of each edge has to be exam-
ined at least once, for dense networks O(n2 ) is the best complexity we
can expect for this problem. Hence Prim’s algorithm attains the best
complexity for this problem on dense networks. However, on sparse
networks, i.e., when |A| = m is much smaller than n2 , it is possible
to construct better algorithms. The next algorithm that we discuss is
Kruskal’s algorithm. It begins with the trivial spanning forest ({1},
∅), . . . , ({n}, ∅), and it examines the edges in A in increasing order
of cost, one after the other, and either discards it or includes it in the
forest. The forest develops in several disconnected components until
all of them are connected in the end. The various components may
be of different sizes during the algorithm. It stores and updates each
component as a tree, and maintains the set of nodes in each component
at each stage.

KRUSKAL’S ALGORITHM

Initialization Order the edges in A in increasing order of cost.


Begin with the trivial spanning forest ({1}, ∅), . . . , ({n}, ∅).

General step Get the next least cost remaining edge in A. Suppose
it is (i; j). If both the nodes i, j on this edge lie in the same
component of the forest at this stage, discard this edge and go to
the next step. If i, j lie in different components of the forest at
this stage, include (i; j) as an in-forest edge and merge the two
components that it connects into a single component. If there
9.2. Min. Spanning Tree Algorithms 639

is only one component now, it is a minimum cost spanning tree,


terminate. Otherwise go to the next step.

Discussion

Let (i; j) be the edge that has come up for examination at some
stage of this algorithm. Suppose i, j both appear in a component,
Fr = (Nr , Ar ) say, at this stage. All the arcs in Ar were examined
<
earlier, so the cost of every edge in Ar is = cij . So, if CC1 is the
fundamental cycle of (i; j) wrt Fr , then (i; j) is a maximum cost edge
on C C1 , and by Theorem 9.5 there exists a minimum cost spanning tree
not containing edge (i; j), among all the spanning trees containing all
the edges in the forest at this stage.
Suppose i, j appear in different components, Fr = (Nr , Ar ), and
Fs = (Ns , As ), say. Then (i; j) is a least cost edge in the cut (Nr ; N \Nr ),
and this cut contains none of the forest edges at this stage. So, by The-
orem 9.4, there exists a minimum cost spanning tree containing edge
(i; j) among the spanning trees containing all the edges in the forest at
this stage.
Applying these arguments in each step from the beginning, we con-
clude that the spanning tree obtained at the termination of this algo-
rithm is a minimum cost spanning tree in G. It can also be verified
that this spanning tree satisfies (9.1).
Computationally, the most expensive operation in this algorithm
is that of arranging the edges in A in ascending order of cost at the
beginning, which requires O(m log m) effort, where m = |A|. Also
since m < n2 , this is the same as O(m log n), where n = |N |. This is
the worst case computational complexity of this method.
It is not actually necessary to order all the edges in A in ascending
order of cost, since we will actually select only (n − 1) of the edges for
the final spanning tree. Any partial quick sort scheme which produces
the least cost remaining edge would be adequate. An ideal scheme
for this is a multipass sorting routine in which each pass produces
the next edge in the ordered sequence very efficiently. Even with all
these refinements, this method is clearly suitable to solve minimum
cost spanning tree problems in relatively sparse networks.
640 Ch. 9. Min. Cost Spanning Trees

When applied to find a minimum cost spanning tree in the network


in Figure 9.1, this algorithm examines the edges in the order (5; 6), (3;
4), (1; 2), (2; 5), (4; 5), includes each of them in the forest and then
terminates with the spanning tree consisting of the thick edges.
The next algorithm for this problem that we discuss is Boruvka’s
algorithm, it dates back to 1926, and seems to be one of the earli-
est algorithms for a network optimization problem. One of the main
features of this algorithm is that it grows the forest, with all its com-
ponents growing simultaneously in every step. This algorithm does not
need the edges ordered in any specific order. The operations in this
algorithm can be carried out unambiguously if all the edge cost coeffi-
cients are distinct. However, if some edge cost coefficients are equal, we
need a unique tie breaking rule for the minimum in every pair of edge
cost coefficients, that holds throughout the algorithm; otherwise there
is ambiguity in the selection of the edges to be included in the forest,
and this may result in cycles being formed. So, we adopt the following
simple tie breaking strategy. Let e1 , . . . , em be the edges in the order in
which they are recorded in the input data, with their cost coefficients
c1 , . . . , cm respectively. Brand the edges with these numbers. Among
a pair of edges, say er , es ; the edge er is considered to be the least cost
one iff either cr < cs , or cr = cs and r < s (conceptually, this strategy
is equivalent to replacing cp by cp + p , for p = 1 to m, where is
treated as an arbitrarily small positive parameter without being given
any specific value).

BORUVKA’S ALGORITHM

Initialization Begin with the trivial spanning forest ({1}, ∅), . . . ,


({n}, ∅).

General step Let F1 = (N1 , A1 ), . . . , Fl = (Nl , Al ), be the con-


nected components in the forest at this stage. Find a least cost
edge in the cut (Nh , N \Nh ), for each h = 1 to l. This can be
carried out in a single operation of examining all the edges once.
Add all these edges to the forest. Determine the connected com-
ponents in the new forest. If only one, it is a minimum cost
spanning tree in G, terminate. Otherwise, go to the next step.
9.2. Min. Spanning Tree Algorithms 641

F ep F
t-1
t t-1
..
ep ep
t r

F Fr
1
ep
r-1
ep
1
..
F2 ep F3
2

Figure 9.3: A situation for the selected edges that could lead to a cycle
in Boruvka’s algorithm.

Discussion

We need to show that the addition of all the new edges in a step
does not create a cycle. Suppose at the beginning of some step, the
trees in the forest are F1 = (N1 , A1 ), . . . , Fl = (Nl , Al ). Suppose a
cycle is created when all the new edges selected in this step are added
to this forest. Each of the selected edges joins a node in one of these
trees, to a node outside this tree. So, a cycle can only be created if a
subset of 2 or more selected edges, ep1 , . . . , ept , say, are such that : epr ,
the least cost edge in the cut (Nr , N \Nr ), joins Fr and another tree,
Fr+1 say, for r = 1 to t, with t + 1 being 1. So, the trees that these
selected edges join are as in Figure 9.3.
Both edges epr−1 and epr are in the cut (Nr , N \Nr ), but epr has been
selected as the least cost edge in this step. So, by the arrangement made
<
at the beginning of this algorithm, cpr = cpr−1 , and if cpr = cpr−1 then
< < <
pr < pr−1 for r = 1 to t with t + 1 being 1. So, cpt = cpt−1 = . . . =
<
cp1 = cpt which implies that cpt = cpt−1 = . . . = cp1 = cpt . Hence we
must have pt < pt−1 < . . . < p1 < pt , which is impossible. Hence cycles
can never be created in this algorithm.
The validity of this algorithm follows from Theorem 9.4. In this
642 Ch. 9. Min. Cost Spanning Trees

method, the number of connected components in the forest is reduced


by a factor of 2 in each step. So, the method terminates after at most
log n steps, and the worst case computational complexity of the method
is O(m log n).
When applied to find the minimum spanning tree in the network in
Figure 9.1, this algorithm selects the edges (1; 2), (3; 4), (5; 6) in the
first step after initialization. At this stage there are three trees in the
forest, each one consisting of a single edge. In the next step it selects
the edges (2; 5), (4; 5) to be added to the forest. With this addition,
we get the spanning tree marked by the thick edges in Figure 9.1, and
the method terminates.
There are several other algorithms for the minimum cost spanning
tree problem based on the same idea of growing a forest using the
greedy principle, and on the results in Section 9.1, but using very so-
phisticated data structures. Some of the best algorithms have the worst
case computational complexity of O(m log log n). The interested reader
is referred to Yao [1975] and Tarjan [1983 of Chapter 1].

Other Problems Solvable by the Greedy Approach

The greedy method applies to a variety of problems besides the min-


imum cost spanning tree problem, in the general setting of matroidal
optimization, see Lawler [1976 of Chapter 1]. However, the real and
fundamental importance of the greedy approach is not mainly due to
its ability to solve a few theoretical problems in matroidal optimiza-
tion exactly; but because of its amenability in constructing heuristic
algorithms to obtain reasonable solutions to many hard problems for
which efficient exact algorithms are not known. There are a large num-
ber of combinatorial optimization problems which do not seem to have
the basic structural properties to guarantee that an optimum solution
for them can be found efficiently by any known approach. The greedy
approach is the basis for the most commonly used heuristic algorithms
to attack such problems that arise in applications. Thus the practical
importance of the greedy approach is enormous. The greedy approach
has 3 characteristic features.

The Incremental Feature It poses the problem in such a way that


9.2. Min. Spanning Tree Algorithms 643

the solution can be viewed as a set of elements. The approach


builds up this solution set one element at a time.
The No-backtracking Feature Once an element is selected for
inclusion in the solution set, it is never taken back or replaced by
some other element.

The Greedy Selection Feature Each additional element selected


for inclusion in the solution set is the best among those available
for selection at that stage.

Several different criteria could be used to characterize the “best”


when making the greedy selection, depending on the problem being
solved. When used as a base for developing heuristic algorithms, the
success of the greedy approach depends critically on the choice of this
criterion.
A second approach that is commonly used in designing heuristic
algorithms is the interchange approach. This approach obtains a
solution set for the problem first, by using a greedy or any other ap-
proach. Then it selects a small positive integer, r, and searches to see if
a better solution set can be obtained by exchanging r or less elements
from the present solution set with those outside it. If an improvement
is obtained, the whole process is repeated with the new solution set.
If no improvement is obtained by the search, the method terminates
with the present solution. Since the computational effort for the search
grows rapidly with r, it is usually taken to be a small positive integer.
The greedy approach coupled with an interchange approach is the basis
for the most commonly used methods by practitioners to handle hard
combinatorial optimization problems.

The Worst Case Performance of the Greedy Approach

On some problems like the minimum cost spanning tree problem,


the greedy method has been shown to yield an optimum solution. How-
ever, it is frequently used on a variety of other combinatorial optimiza-
tion problems on which it is not guaranteed to find an optimum so-
lution. How does it perform on such problems? Here we summarize
the disturbing results of Jenkyns [1986], who has constructed examples
644 Ch. 9. Min. Cost Spanning Trees

of assignment and traveling salesman problems on which the greedy


method produces the worst possible solution.
Consider the assignment problem of order n in which the objective
function is required to be maximized (the algorithms for the assignment
problem in Chapter 3 are described in terms of minimization). Let
C = (cij ) be the objective coefficient matrix. The most direct version of
the greedy method identifies a cell (p, q) with the maximum coefficient
in C, puts an allocation in that cell, strikes off row p and column q,
and continues in the same manner with the remaining matrix until
n allocations are made. Let n = 6, consider this problem with the
following matrix C = (cij ).

cij
j= 1 2 3 4 5 6 ūi
i=1 1 2 6 10 17 29 0
2 3 4 8 11 20 30 2
3 5 7 9 12 22 33 4
4 13 14 15 16 23 34 9
5 18 19 21 24 25 35 16
6 26 27 28 31 32 36 24
v̄j 1 2 5 7 9 12

It can be verified that the greedy method produces the unit matrix
with all allocations along the main diagonal, as the optimum assign-
ment. However, from the ū, v̄ vectors given in the above tableau, it can
<
be verified that ūi + v̄j = cij for all i, j; and ūi + v̄i = cii for i = 1 to
6; from the results in Chapter 3 this establishes that the unit matrix
is the minimum objective value assignment in this problem. Hence
the unit matrix is the worst candidate for the problem of maximiz-
ing the objective function considered here. So, on this problem, any
random selection is a better answer than that produced by the greedy
algorithm.
A square matrix C of order n is defined to be gullible (to in-
dicate that it will be an easy victim of a shady lady) if the greedy
algorithm produces the worst possible answer for the objective maxi-
mizing assignment problem with C as the objective coefficient matrix.
Let û = (û1 , . . . , ûn ), v̂ = (v̂1 , . . . , v̂n ) be any pair of vectors in which
9.3. Ranking Algorithm 645

the components are nondecreasing left to right. Select cij to satisfy


< <
ûi + v̂j = cij = ûm + v̂m where m = max. {i, j}, for all i, j. Then it can
be verified that the greedy method produces the unit matrix of order n
as the solution to the objective maximizing assignment problem with
C as the objective coefficient matrix, and this is actually a minimum
objective solution in this problem. Hence such matrices are gullible.
Jenkyns [1986] has given many other procedures to generate gullible
matrices and shows that they are not intricately contrived pathological
cases.
At least for the assignment problem there are very efficient exact
algorithms available, and no one would have to resort to heuristics
to solve it. However, the traveling salesman problem (TSP) is a well
known NP-hard problem, large scale versions of which are commonly
solved using greedy type methods in many applications. Jenkyns [1986]
has constructed examples of TSPs in n cities for all n, and showed that
a simple greedy heuristic produces the worst possible tour on each of
them.
These results show that it is not wise to rely entirely on a greedy
heuristic by itself, to tackle hard combinatorial optimization problems
without some sort of error analysis.

How to Find Maximum Length Spanning Trees

If a maximum length spanning tree in G = (N , A) with c as the


edge length vector is required, it can be obtained by finding a minimum
length spanning tree in G with −c as the edge length vector. The al-
gorithms discussed above for the minimum cost spanning tree problem
work for arbitrary cost coefficients.

9.3 An Algorithm for Ranking the Span-


ning Trees in Ascending Order of Cost
Let G = (N , A, c) be a connected undirected network with c as the edge
cost vector, and |N | = n, |A| = m. In Section 9.2 we discussed several
algorithms for finding an unconstrained minimum cost spanning tree in
646 Ch. 9. Min. Cost Spanning Trees

G. In some applications, a minimum cost spanning tree satisfying some


constraints may be required. One possible approach for finding such a
tree is to rank the spanning trees in G in increasing order of cost until
one satisfying the constraints is found. Here we present an algorithm
for this ranking from Murty, Saigal, and Suurballe [1974] based on
the application of the partitioning technique discussed in Sections 3.6
and 4.7. We denote the ranked sequence of spanning trees in G by
1, 2 , . . . where 1 is a minimum cost spanning tree in G, and for
>
u = 1, u+1 is a minimum cost spanning tree in G excluding the trees
1, . . . , u.
The algorithm deals with subsets of spanning trees in G which will
be denoted using a special notation defined below. Here a1 , . . . , ar , b1 , . . . , bs
are edges in A.

Set of all spanning trees


in G containing each
τ0 = [a1 , . . . , ar ; b̄1 , . . . , b̄s ] = of the edges a1 , . . . , ar ; (9.4)
and none of the edges
b1 , . . . , bs .
The edges a1 , . . . , ar are said to be the included edges in τ0 ; and
the edges b1 , . . . , bs are said to be the excluded edges from τ0 .
Let τ = [a1 , . . . , ar ; b̄1 , . . . , b̄s ] be a set of spanning trees in G, and
let consisting of edges a1 , . . ., ar , er+1 , . . ., en−1 ; be a minimum cost
spanning tree among those in τ . Define the following new subsets.

τ1 = [a1 , . . . , ar ; b̄1 , . . . , b̄s , ēr+1 ]


τ2 = [a1 , . . . , ar , er+1 ; b̄1 , . . . , b̄s , ēr+2 ]
τ3 = [a1 , . . . , ar , er+1 , er+2 ; b̄1 , . . . , b̄s , ēr+3 ]
..
.
τn−r−1 = [a1 , . . . , ar , er+1 , . . . , en−2 ; b̄1 , . . . , b̄s , ēn−1 ]

For j = 1 to n−r −1, it is easy to check whether τj = ∅, and if so to


find a minimum cost spanning tree in it. Find the fundamental cutset
9.3. Ranking Algorithm 647

of the in-tree arc er+j wrt , suppose it is (X; X). The edge er+j is
the unique in-tree edge in in the cutset (X; X), and it is a minimum
cost edge among edges of this cutset not in {b1 , . . . , bs } since is a
minimum cost spanning tree among those in τ . The subset τj is empty
iff the cutset (X; X) ⊂ {b1 , . . . , bs , er+j }, the set of excluded edges in
τj . If (X; X) ⊂ {b1 , . . . , bs , er+j }, let er+j be a minimum cost edge in
the cutset (X; X) that is not contained in {b1 , . . . , bs , er+j }. Then the
spanning tree j obtained by replacing er+j in by er+j ; is a minimum
cost spanning tree among those in τj . Clearly, the computational effort
needed to check whether τj = ∅ and finding a minimum cost spanning
tree j in it if it is nonempty is at most O(m) by this approach.
Each of the sets τ1 , . . . , τn−r−1 is again in the same form as in (9.4),
and clearly they are mutually disjoint, and their union is τ \{ }. These
sets are said to be the new sets generated when τ is partitioned using
the minimum spanning tree in it. The number of these sets is n −
1−(number of included edges in τ ), and some of these sets may be
empty. Clearly, a minimum cost spanning tree among those in τ \{ }
is the best among { j : j = 1 to n − r − 1 such that τj = ∅ }.
The ranking algorithm generates various sets of spanning trees in
G of the form defined in (9.4). Each nonempty set among these is
stored in a list, together with a minimum cost spanning tree in it, in
increasing order of the cost of this tree, going from top to bottom.
Each step of the algorithm generates one additional spanning tree in
the ranked sequence, and adds at most n − 1 new sets to the list. The
computational effort of each step is at most O(mn), and the method
can be terminated any time, after enough spanning trees in the ranked
sequence have been obtained.

RANKING ALGORITHM

Initial step Find a minimum cost spanning tree in G and call it


1 , the first tree in the ranked sequence. Suppose the edges in
it are e1 , . . . , en−1 . Define the subsets: τ1 = [ē1 ], τ2 = [e1 ; ē2 ],
. . . , τn−1 = [e1 , . . . , en−2 ; ēn−1 ]. Find a minimum cost spanning
tree in each of these subsets, and arrange the nonempty subsets
among them in increasing order of cost of the minimum cost
648 Ch. 9. Min. Cost Spanning Trees

spanning tree in them (as you go from top to bottom) in the list.

General step Suppose the trees 1 , . . . , u in the ranked sequence


have already been obtained. Pull out the set from the top of the
list now, suppose it is τ , and delete it from the list. u+1 is the
stored minimum cost spanning tree in τ . If no more elements in
the ranked sequence are needed, terminate. Otherwise, partition
τ using u+1 . Find the minimum cost spanning tree in each of
the new sets generated at this partition, as described above, and
add the nonempty sets among them, together with the minimum
cost spanning tree in it in the appropriate place in the list, and
go to the next step.

Discussion

If only a certain number, α say, of the spanning trees in the ranked


sequence are required, only the top α sets in the list need be kept, and
the rest discarded. If the aim is to obtain all spanning trees whose cost
<
is = some specified β, any set generated during the algorithm is stored
<
only if the cost of the minimum spanning tree in it is = β.

9.4 Other Types of Minimum Cost Span-


ning Tree Problems
So far we have dealt with the unconstrained minimum cost spanning
tree problem in networks, ignoring any orientations of the lines. Here
we will discuss other types of minimum spanning tree problems briefly.

Constrained Minimum Cost Spanning Tree Problems

If we are required to find a minimum spanning tree subject to degree


constraints at one or more nodes (i.e., those of the form: at certain
nodes i, the tree can have no more than a specified number di of incident
edges, or should have exactly a specified number of incident edges,
etc.), we have a degree constrained minimum cost spanning tree
problem. Problems with a degree constraint at only one node can be
9.4. Other Min. Spanning Tree Problems 649

transformed into unconstrained problems (Gabow and Tarjan [1984]).


Problems with degree constraints at nodes no pair of which are adjacent
in G can be formulated as weighted matroid intersection problems and
solved by efficient matroidal algorithms (Gabow and Tarjan [1984],
Lawler [1976 of Chapter 1]).
But if degree constraints appear at all the nodes in G, the problem
becomes a hard combinatorial optimization problem. As an example
consider the case where the degree in the tree at every node is required
<
to be = 2. Any feasible spanning tree to this problem is a node covering
simple path and vice versa, such paths are called Hamiltonian paths.
To check whether a Hamiltonian path exists in an undirected network
is NP-complete, and to find a minimum cost Hamiltonian path is NP-
hard.

The Steiner Tree Problem in Networks

So far we have considered problems of finding optimum trees that


span all the nodes in the network. In the Steiner tree problem, we
are given a connected undirected network G = (N , A, c) and a subset
of nodes X ⊂ N . The problem is to find a minimum cost tree
in G subject to the constraint that must include all the nodes in
X, but may or may not include the nodes in N \ X. So, the problem
is equivalent to finding a subset of nodes Y satisfying X ⊆ Y ⊆ N
such that the cost of a minimum spanning tree in the subnetwork of
G induced by Y is the least subject to this constraint. Nodes in the
optimal Y which are not in X are called Steiner points for this
problem. So, the problem boils down to the optimal choice of Steiner
points from N \ X.
This problem is the network version of the well known Euclidean
or rectilinear Steiner problem in geometry. There, we are given
a set P of points in the 2-dimensional plane. The problem is to con-
nect the points in P by straight line segments so that the total length
(Euclidean or rectilinear) of the line segments drawn is a minimum.
Some of these lines could meet at points in the plane which are not in
the set P, such points are the Steiner points in the solution of this
problem. As an example consider the problem in which P = {P1 , to
650 Ch. 9. Min. Cost Spanning Trees

.
(4, 4)
P
3
.
P
3

P2 .
(0, 3)
P2 .
. .
0 0
120 120

S S2
1
P
1
. P
1
.
(0, 1)
P
4 . P4 .
(4, 0)

(a) Shortest connecting network (b) Shortest connecting network


with no out side point s with two S teiner point s
S ,S
1 2
Figure 9.4:

P4 } as shown in Figure 9.4 (a). If no outside points are allowed, the


shortest connecting network has Euclidean length of 10.123. By intro-
ducing 2 Steiner points S1 , S2 as shown in Figure 9.4 (b), the Euclidean
length of the connecting network reduces to 9.196.
The Steiner tree problem in networks is a hard combinatorial op-
timization problem. Exact enumerative algorithms are available for
solving it, but the computational effort required by these algorithms
grows exponentially with |N \X|.

Directed Spanning Tree Problems

So far we have discussed spanning tree problems in undirected net-


works. Consider now a directed network G = (N , A, c) with |N | =
n, |A| = m. Suppose we are given a designated node, say node 1, as
the root node. A branching rooted at 1 is a spanning outtree rooted
at 1. The problem of finding a minimum cost branching rooted at 1 in
9.5. Exercises 651

5 5

1 5 4

5 1

Figure 9.5:

has a very efficient algorithm of time complexity O(nm). But it does


not seem to be of much practical importance, so we will not discuss it.
See references given at the end of this chapter.

9.5 Exercises
9.3 Construct a directed network with positive arc lengths to show
that a shortest chain tree rooted at a node may not be a minimum cost
branching rooted at that node (try the network in Figure 9.5, with
node 1 as the root node. Arc lengths are entered on the arcs).
9.4 Given a minimum cost spanning tree in an undirected network,
develop an efficient procedure for doing cost ranging on it, i.e., to de-
termine the range of values of each cost coefficient which does not affect
the minimality of the tree (Tarjan [1982]).
9.5 We are given a minimum cost spanning tree in an undirected
connected network. Develop an efficient procedure to update into a
minimum cost spanning tree when a new node and incident edges are
added to the network (Spira and Pan [1975]).
9.6 Develop good heuristic algorithms based on the greedy approach
for the following combinatorial optimization problems.
652 Ch. 9. Min. Cost Spanning Trees

(a) The Knapsack Problem In this problem we are given n ob-


jects with wi , vi as the weight, value of the ith object, i = 1 to n.
A knapsack with weight capacity w is provided. It is required to
find an optimal subset of objects to be loaded into the knapsack,
so as to maximize its value, subject to the knapsack’s weight ca-
pacity. All data are positive integers. Mathematically, it is to
find x = (xi : i = 1 to n) to
maximize v1 x1 + . . . + vn xn
<
subject to w1 x1 + . . . + wn xn = w
and xi = 0, or 1, i = 1 to n
Apply your heuristic algorithm for obtaining a solution to the
following journal subscription problem faced by a librarian. The
librarian has to decide an optimum subset among 8 journals to
renew the subscription, with only 500$ available in the new bud-
get for these journals. Other data is given below. The journals
selected by the librarian should satisfy the maximum number of
users subject to the budget constraint.
Journal i wi , annual vi , no. of
subscription in $ users per year
1 80 7840
2 95 6175
3 115 8510
4 165 15015
5 125 7375
6 78 1794
7 69 897
8 99 8315

(b) The Set Covering Problem This is a 0-1 integer program-


ming problem of the following form

minimize cx
>
subject to Ax = e
x is a 0 − 1 vector
9.5. Exercises 653

where e on the right hand side is a column vector of all 1’s in


IRm , A = (aij ) is a given 0-1 matrix of order m × n, and c is a
positive row vector in IRm . Apply your heuristic algorithm on
the following numerical example. Here m = 10, n = 13, c is the
row vector of all 1’s in IR13 , and the sets Γi = {j : j = 1 to 13
such that aij = 1} are: Γ1 = {7, 9, 10, 13}, Γ2 = {2, 8, 9, 13},
Γ3 = {3, 9, 10, 12}, Γ4 = {4, 5, 8, 9}, Γ5 = {3, 6, 8, 11}, Γ6 =
{3, 6, 7, 10}, Γ7 = {2, 4, 5, 12}, Γ8 = {4, 5, 6, 13}, Γ9 = {1, 2,
4, 11}, Γ10 = {1, 5, 7, 12}.

9.7 Let G = (N , A, c) be an undirected connected network. Let d1


be the degree on node 1 in G. Let Dr denote the set of spanning trees
in G containing exactly r edges incident at 1. Show that there exists a
> < <
u = 1 such that the set of all r for which Dr = ∅ is u = r = d1 .
Suppose is a minimum cost spanning tree in Dr for some r. Then
prove that

(a) if Dr−1 = ∅, there are edges e1 of incident at 1, and e2 ∈ A


not incident at 1 and not in ; such that replacing e1 in by e2
yields a minimum cost tree in Dr−1
(b) if Dr+1 = ∅, there are edges e1 not in and incident at 1, and e2
in not incident at 1; such that replacing e2 in by e1 yields a
minimum cost tree in Dr+1 .

Use these results to develop an efficient algorithm for finding a


minimum cost spanning tree in G satisfying a degree constraint at
node 1, as this specified degree varies parametrically (Gabow [1978]).

9.8 Minimum Ratio Spanning Trees Let G = (N , A) be a con-


nected undirected network with two vectors a = (aij ), b = (bij ) of edge
cost coefficients defined over A. For any tree in G, define z( ) =
( (aij : over (i; j) ∈ )/( (bij : over (i; j) ∈ ). Assume that the
vector b is such, that the denominator of z( ) has the same sign for
every spanning tree in G, without any loss of generality we assume that
this sign is positive. Consider the problem of finding a spanning tree
in G that minimizes z( ). Let z ∗ denote the unknown optimum
objective value for this problem
654 Ch. 9. Min. Cost Spanning Trees

1,4 50,100

1 1,4 4

8,10
3

Figure 9.6: Entries on the edges are aij , bij in that order.

Consider the following greedy approach for this problem. It grows


a connected tree by adding one selected edge at a time, making sure
that each edge added does not form a cycle with those already selected,
and among such edges it selects the one which increases the objective
function by the smallest quantity. Use the network in Figure 9.6 to
show that this approach may not lead to an optimum solution of this
problem.
Let α be a real valued parameter. Define for each (i; j) ∈ A, cij (α) =
aij − αbij . Let ˆ (α) denote a minimum cost spanning tree in G with
c(α) = (cij (α)) as the edge cost vector, and let h(α) be its cost. Prove
that


⎨ > 0 iff z ∗ > α
h(α) ⎪ < 0 iff z ∗ < α

= 0 iff z ∗ = α
Let e, g denote any pair of edges in G. When ae − αbe , ag − αbg
are plotted against α on the 2-dimensional Cartesian plane, we get
two straight lines which may either be identical, or nonintersecting
parallel lines, or two lines intersecting at a unique point. For every
pair of edges e, g in G for which the two lines given above intersect at
a unique point, define α(e, g) = (ae − ag )/(be − bg ), and let ∆ be the
<
set of all such α(e, g). So, |∆| = |A|2 . Suppose there are r distinct
elements in ∆, order them in increasing order, and then suppose they
are −∞ < α1 < α2 < · · · < αr < +∞. Prove that for any α in any one
of the open intervals (−∞, α1 ), (α1 , α2 ), . . . , (αr , +∞), the minimum
9.5. Exercises 655

cost spanning tree ˆ (α) is actually a minimum cost spanning tree for
every α in that interval. Hence h(α) is linear in each of these intervals.
Using this result, develop an efficient algorithm for finding a spanning
tree in G that minimizes z( ), and determine its computational
complexity (Chandrasekaran [1977]).

9.9 In applying Kruskal’s algorithm to find a minimum cost spanning


tree in G, if r is the number of forest edges in a step, prove that the
forest at that stage is a minimum cost forest of cardinality r in G.

9.10 It is required to find a single tree in G of minimum cost contain-


ing r edges. Develop an efficient approach for solving this problem.

9.11 G = (N , A, c) is a connected undirected network with c > 0.


Develop efficient methods for finding spanning trees in G that minimize
: (a) the product of the cost coefficients of in-tree edges, (b) the cost of
the costliest in-tree edge, (c) any symmetric cost function of edge cost
coefficients.

9.12 Let G = (N , A) be a connected undirected network with |N | =


n, |A| = m. The characterization of the convex hull of spanning
tree incidence vectors in G described in Exercise 9.2 has about 2n
constraints. Here we discuss a constraint formulation of the convex
hull of spanning trees in G, in a higher dimensional space, with only
O(mn) constraints. Additional variables called auxiliary variables are
introduced. In this formulation, a particular node, say 1, is selected
as a source node. Each of the other nodes r = 1 is associated with a
distinct commodity for which it is the sink node. So, there are (n − 1)
different commodities in this formulation, and node 1 has one unit of
each of these commodities available for shipment.
For each (i; j) ∈ A with both i, j = 1 create two arcs (i, j) and
(j, i). For each edge (1; j) in G create an arc (1, j). Let A denote the
set of all these created arcs. So, |A| = 2m − degree of node 1 in G.
Define Ai = {j : (i, j) ∈ A}, Bi = {j : (j, i) ∈ A }, for each i ∈ N .
Introduce a variable xi;j for each (i; j) ∈ A; it is the spanning tree-
edge incidence variable for that edge; and auxiliary variables yijr for
each arc (i, j) ∈ A and r = 2 to n. yijr denotes the flow of commodity
656 Ch. 9. Min. Cost Spanning Trees

r on arc (i, j). Let x = (xi;j ), y = (yijr ). Consider the following system
of constraints.

(xi;j : over (i; j) ∈ A) = n−1


r
(y1i : over i ∈ A1 ) = 1, r = 2 to n
(yijr : over i ∈ Bj )
r
− (yji : over i ∈ Aj ) = 0, j = 2 to n, j = r;
r = 2 to n
r
(yir : over i ∈ Br ) = 1, r = 2 to n (9.5)
r <
y1j − x1;j = 0, j ∈ A1 , r = 2 to n
p <
yijr + yji − xi;j = 0, i, j both = 1, (i; j) ∈ A;
r, p = 2 to n
< <
0 = xi;j = 1, (i; j) ∈ A
>
yijr = 0, (i, j) ∈ A, r = 2 to n

Prove that the projection of the feasible solution set of (9.5) in the
x-space, is the convex hull of spanning tree incidence vectors in G (Kipp
Martin [1986], Wong [1984]).

9.13 The Capacitated Minimum Spanning Tree Problem G


= (N , A, c, k) is a connected undirected network with c as the vector of
edge cost coefficients, and k as the vector of edge flow capacities. One
of the nodes in G, 1, is the sink node; and all other nodes are source
nodes, with i = 1 required to ship ai units of a commodity from it to
node 1. The problem is to find a spanning tree in G along the simple
paths in which all these shipments will be carried out. A spanning
tree is said to be feasible to this problem if all these flows can be
carried out on it without violating the edge capacity on any in-tree
edge, infeasible otherwise. For example, the spanning tree on the left
in Figure 9.7 is infeasible for the capacitated problem, whereas the one
on the right is feasible (in the figure, capacities of all the edges are 5,
and for each i = 1, ai is entered by the side of node i, the data is the
same in both the trees ). Develop either an exact method, or a good
9.5. Exercises 657

1 1

a2 = 2
2 3
2 2 1

4 2 3 5
3 1 2 4

5 3

Figure 9.7: Capacity of every edge is 5. ai is entered by the side of


node i. The tree at the left is infeasible, and the one on the right is
feasible, for the capacitated problem.

heuristic method, for finding a minimum cost feasible spanning tree for
the capacitated problem (Chandy and Lo [1973]).

9.14 A Constrained Minimum Spanning Tree Problem Node


1 is the center that will be the root of a spanning tree in G = (N , A, c).
Each node i = 1 is associated with a load of ai . It is required to find a
minimum cost spanning tree in G satisfying: there should be no more
than n0 nodes connected to the center by an in-tree edge, there should
be no more than l edges in tandem in a path connecting a node to the
center, the total load on any edge (the sum of the loads of all nodes
it connects to the center) cannot be greater than a specified d, and
that no node other than the center have degree greater than a specified
number r. Constrained minimum spanning tree problems of this type
arise in designing centralized telecommunication and data communica-
tion networks using a single speed line. Develop a heuristic algorithm
based on Kruskal’s algorithm to generate high quality solutions to this
problem (Kershenbaum [1974]).
658 Ch. 9. Min. Cost Spanning Trees
>
9.15 G = (N , A, c) is a connected undirected network with c = 0.
Develop 0-1 integer programming formulations for the following con-
strained minimum cost spanning tree problems in G: a) for each node
in a specified subset of nodes, an upper bound on the number of in-tree
edges incident at that node is specified, b) the number of descendents
<
of each son node of a specified root node is required to be = a specified
positive integer α (Gavish [1982]).

9.16 For any subset N ⊆ N of nodes in an undirected network G =


(N , A), let E(N) denote the set of edges with both their nodes in N.
Prove that the set of feasible solutions x = (xe : e ∈ A) of the following
system, is the convex hull of forest-edge incidence vectors in G.

< >
(xe : over e ∈ E(N)) = |N| − 1, for each N ⊆ N with |N| = 2
>
xe = 0, for all e ∈ A

(Edmonds [1969]).

9.17 Let lij denote the number of lines on the simple path between
nodes i, j in a tree . For each i in , define θi = max. {lij : over nodes
j in }. A center of is defined to be a node in that minimizes
θi . Show that the following algorithm finds a center for . Also, find
the center of the tree in Figure 9.8 using this algorithm.

<
Step 1 If the number of nodes in the tree is = 2, any node in the
tree is a center, terminate. Otherwise go to Step 2.

Step 2 Identify all the terminal nodes in the tree, and delete them
and the lines incident at them from the tree. Go to Step 3.
<
Step 3 If the number of remaining nodes is = 2, any of these is a
center for the original tree, terminate. Otherwise return to Step
2 with the remaining tree.
9.5. Exercises 659

Figure 9.8:

9.18 Let be a tree spanning n nodes. For nodes i, j in define lij


as in Exercise 9.17. For a node i in let j1 , . . . , jp be all its adjacent
nodes in , and let jr be the subtree containing node jr when the line
joining i and jr is deleted from , r = 1 to p. Let nr be the number
of nodes in jr , r = 1 to p. Node i in is said to be a centroid of
<
iff nr = n/2 for all r = 1 to p. Prove that σi = (lij : over j in )
is minimized iff i is a centroid of . Develop an efficient algorithm for
finding a centroid of . Apply your algorithm to find a centroid of the
tree given in Figure 9.9 (Kang, Lee, Chang, and Chang [1977], Kang
and Ault [1975]).

Figure 9.9:

9.19 Shallow Minimum Spanning Trees G = (N , A, c) is a con-


nected undirected network. Among all minimum cost spanning trees
in G, it is required to find one which is as shallow as possible (i.e., has
the smallest number of levels when it is drawn as a rooted tree). Show
660 Ch. 9. Min. Cost Spanning Trees

that the following variant of Prim’s algorithm finds such a tree. In this
algorithm, X denotes the set of in-tree nodes, which grows by one in
each step.

Step 0 Select any node i, let X = {i}. Go to Step 1.

Step 1 For each j ∈ N \X, define dj = min. {cij : over i ∈ X}. Find
a node q ∈ N \X which minimizes dj over j in this set. Let Y be
the set of all i in X which tie for the minimum in the definition
of dq . If Y is a singleton set, let p be the node in it, otherwise
define p to be the node in Y which has the maximum number of
in-tree edges incident at it at this stage. Select (p; q) as the next
in-tree edge, and transfer q into X from N \X. If X is now N ,
terminate. Otherwise, repeat this step.

Develop appropriate data structures to obtain an efficient imple-


mentation of this algorithm (Kang, Lee, Chang, and Chang [1977]).

9.20 A min-max spanning tree in G is one which minimizes the max-


imum cost among all in-tree edges. Prove that every minimum cost
spanning tree is also a min-max spanning tree, but the converse may
not be true. Develop an O(m) complexity algorithm to find a min-max
spanning tree in G (Camerini [1978]).

9.21 is a minimum cost spanning tree in the connected undirected


network G = (N , A, c). G = (N , A , c ) is the network obtained when
a node i and all the edges incident at it are deleted from G. Assume
that G is connected. Let i = (N , Ei ) be the forest remaining when
node i and all the in-tree edges incident at it are deleted from .
If i is a leaf node in , show that i is a minimum cost spanning
tree in G .
Suppose i is not a leaf node in . Let G = (N , A ) be an undi-
rected network whose vertex set is the set of connected components
of i , and every edge e = (a, b) in A corresponds to an edge e in
A such that e has the smallest cost among all the edges connecting
the components a and b of i in G . Shoe that G is connected, and
that if = (N , E ) is a minimum cost spanning tree in G then
9.5. Exercises 661

E = Ei ∪ E is such that = (N , E ) is a minimum cost spanning


tree in G .
Using these results, develop an efficient algorithm to update the
minimum cost spanning tree when a vertex is deleted from the network
(Chin and Houck [1978], Tsin [1988]).

9.22 Minimum Cost Spanning Tree Problen as a Min-Max


Path Problem Let G = (N = {1, 2, . . . , n}, A, c) be a connected
undirected network. Assume that all the entries in c are distinct, other-
wise the perturbation discussed under Bourvka’s can be used to achieve
this. Define the cost of any path in G to be the max. {cij : (i; j) is an
0
edge on the path}. Define lij = ∞ if (i; j) ∈ A, cij if (i; j) ∈ A. For all
i, j, r = 1 to n define

r
lij = cost, as defined above, of the least cost path from i to j
that passes through only vertices in the set {1, 2, . . . , r}.
For any i, j ∈ N , the least cost path between i and j with no
intermediate vertex higher than r either passes through r (in this case
r r r r r−1
lij = max. {lir , lrj }) or does not (in this case lij = lij ). Using this,
r r−1 r−1 r−1
prove that lij = min. {lij , max. {lir , lrj }}.
Prove that the unique minimum cost spanning tree in G in this
case can be recovered from the costs of the least cost paths using the
rule: the edge (i; j) ∈ A is in the minimum cost spanning tree in G iff
0 n
lij = lij (Maggs and Plotkin [1988]).

9.23 Develop an efficient algorithm for finding a minimum cost span-


ning tree in G, subject to the constraint that it contain a specified
number, r, of edges from a given subset S ⊂ A (Gabow and Tarjan
[1984]).

9.24 Optimum Face of the Minimum Cost Spanning Tree


Problem Let G = (N , A, c) be a connected undirected network with
c = (cij ) as the vector of edge cost coefficients. There may be several
spanning trees in G, which tie for being a minimum cost spanning tree
in G. Let E denote the set of all edges in A, each of which is contained
on at least one minimum cost spanning tree in G.
662 Ch. 9. Min. Cost Spanning Trees

1. Is the statement “every spanning tree in the partial subnetwork


(N , E) is a minimum cost spanning tree in G” correct? Either
prove it, or construct a counterexample.

2. If all the entries in the cost vector c are distinct, prove that there
is a unique minimum cost spanning tree in G.

3. Suppose that some of the edge cost coefficients are equal to each
other. Arrange the distinct values among {cij : (i; j) ∈ A} in
increasing order, and let them be α1 , . . . , αp . For t = 1 to p, let
St = {(i; j) : cij = αt }. Then S1 is the set of least cost edges in
G, S2 is the set of edges with the second best cost, etc.

(a) If after deleting all the edges in Sp (the maximum cost


edges) the network remains connected, then prove that none
of the edges in Sp is contained on any minimum cost span-
ning tree in G.
(b) Prove that every minimum cost spanning tree in G must
contain at least one of the edges in S1 as an in-tree edge.
(c) Let 0 be any minimum cost spanning tree in G, and
let rt be the number of edges from St in 0 , for t = 1 to
p. Then prove that every spanning tree in G containing
exactly rt edges from St for each t = 1 to p is a minimum
cost spanning tree in G and vice versa.
In this case, prove that the convex hull of minimum cost
spanning tree incidence vectors in G is the set of feasible
solutions of (9.3) and the additional constraints

(xij : over (i; j) ∈ St ) = rt , t = 1 to p

Define a second best valued spanning tree in G to be a min-


imum cost spanning tree among those with cost > cost of
0 . In this case, using the algorithm mentioned in Exercise
9.23, develop an O(pm logn) algorithm to find a second best
valued spanning tree in G.

(Murty, Hamacher, and Maffioli [1991]).


9.5. Exercises 663

Comment 9.1 The minimum cost spanning tree problem (MCST)


is a classical problem concerned with the design of optimum networks.
For example, it arises when several points in a region have to be linked
via cable at minimum cost. It is the first network optimization problem
for which an efficient algorithm has been developed. Graham and Hell
[1985] survey the history of the problem.
Boruvka [1926] seems to have been the first to develop an algorithm
for this problem. Choquet [1938] has rediscovered the same algorithm.
We discussed this algorithm, as well as those of Kruskal [1956] and Prim
[1957]. All these methods are based on the incremental technique of
building the optimum tree, edge by edge, using the greedy selection
rule. The greedy method solves a variety of other problems besides
the MCST. The MCST has a powerful generalization in the setting of
matroid theory, it is the problem of finding a minimum cost base of
a matroid (the cost of a base is the sum of the costs associated with
the elements in it, see Lawler [1976 of Chapter 1] for a discussion of
matroid theory relevant to the area of optimization). The MCST is a
special case of this problem corresponding to a graphic matroid. The
greedy method can be used to find a minimum cost base of a matroid.
Prim’s algorithm has been developed earlier by Jarnik [1930], and
improved by Dijkstra [1959 of Chapter 4].
A variety of techniques have been developed to improve the worst
computational complexity of these algorithms on sparse networks. These
techniques involve sophisticated data structures. See Cheriton and Tar-
jan [1976], Johnson [1975], and Yao [1975]. Tarjan [1983 of Chapter 1]
contains surveys on the MCST and variants of it. Parallel algorithms
for the MCST are discussed by Akl [1986], Lavallee [1984], Lavallee and
Roucairol [1986], and Nath and Maheswari [1982]. Some applications of
the MCST are discussed by Ali and Kennington [1986], Gavish [1982],
Held and Karp [1970], Hu[1961], Kang, Lee, Chang, and Chang [1977],
and Magnanti and Wong [1984]. Sensitivity analysis and updating an
optimum MCST under changes in the data are discused in Chin and
Houck [1978], Spira and Pan [1975], Tarjan [1982], and Tsin [1988].
The related theoretical problem of characterizing K = convex hull
of the spanning tree incidence vectors in G = (N , A) with n nodes
and m edges, through a system of linear constraints has attracted a
664 Ch. 9. Min. Cost Spanning Trees

good deal of attention. If we use only the edge incidence variables,


this characterization requires about 2n constraints in them (Exercise
9.2). Recently Kipp Martin [1986] and Wong [1984] have shown that
by introducing additional variables called auxiliary variables, a convex
polyhedron Γ can be defined through a system of O(nm) linear con-
straints only, such that K is the projection of Γ in the subspace of the
edge incidence variables.
The greedy algorithm has been used for a long time as a heuristic
approach to obtain solutions for many hard combinatorial optimization
problems arising in real world applications, even though the method
is not guaranteed to produce an optimum or even near optimum solu-
tion on such problems. Recently Jenkins [1986] has constructed simple
assignment and traveling salesman problems on which he shows that
the greedy method leads to the worst possible solution for them (i.e.,
a solution actually minimizing the objective function which is required
to be maximized). These examples indicate the need for extreme cau-
tion while using such heuristic methods to solve problems on which the
methods performance is unknown.
Most of the constrained minimum cost spanning problems tend to
be hard problems. See Chandy and Lo [1973], Gabow [1978], and
Kershenbaum [1974] for a discussion of some constrained spanning tree
problems.

9.6 References
S. AKL, 1986, “An Adaptive and Cost-Optimal Parallel Algorithm for Minimum
Spanning Trees,” Computing, 36(271-277).
I. ALI and J. KENNINGTON, 1986, “The Asymmetric M-Traveling Salesman
Problem: A Duality Based Branch and Bound Algorithm,” DAM, 13(259-276).
O. BORUVKA, 1926, “O Jistém Problému Minimalnim,” Pracá Moravské Pr̆irodovĕdecké
Spolec̆nosti, 3(37-58), in Czech.
P. M. CAMERINI, Jan. 1978, “The Min-Max Spanning Tree Problem and Some
Extensions,” IPL, 7, no. 1(10-14).
P. M. CAMERINI, L. FRATTA, and F. MAFFIOLI, 1979, “A Note on Finding
Optimum Branchings,” Networks, 9(309-312).
R. CHANDRASEKARAN, 1977, “Minimal Ratio Spanning Trees,” Networks, 7,
9.6. References 665

no. 4(335-342).
K. M. CHANDY and T. LO, 1973, “The Capacitated Minimum Spanning Tree,”
Networks, 3, no. 2(173-181).
D. CHERITON and R. E. TARJAN, 1976, “Finding Minimum Spanning Trees,”
SIAM Journal on Computing, 5(724-742).
F. CHIN and D. HOUCK, 1978, “Algorithm for Updating Minimum Spanning
Trees,” Journal of Computer and System Science, 16(333-344).
G. CHOQUET, 1938, “Etude de Certains Reseaux de Routes,” C. R. Acad. Sci.
Paris, 206(310-313).
J. EDMONDS, 1970, “Submodular Functions, Matroids and Certain Polyhedra,”
PP 69-87 in R. Guy(ed. ), Combinatorial Structures and Their Applications, Pro-
ceedings of the Calgary International Conference, Gordon Breach, N.Y.
H. N. GABOW, 1978, “A Good Algorithm for Smallest Spanning Tree With a De-
gree Constraint,” Networks, 8(201-208).
H. N. GABOW and R. E. TARJAN, Mar. 1984, “Efficient Algorithms for a Family
of Matroid Intersection Problems,” Journal of Algorithms, 5, no. 1(80-131).
R. G. GALLAGER, P. A. HUMBLET, and P. M. SPIRA, 1983, “A Distributed
Algorithm for Minimum-Weight Spanning Trees,” ACM Transactions on Program-
ming Languages and Systems, 5(66-77).
B. GAVISH, 1982, “Topological Design of Centralized Computer Networks - For-
mulations and Algorithms,” Networks, 12(355-377).
R. L. GRAHAM and P. HELL, Jan. 1985, “On the History of the Minimum Span-
ning Tree Problem,” Ann. History of Computing, 7, no. 1(43-57).
M. HELD and R. KARP, 1970, “The Traveling Salesman Problem and Minimum
Spanning Trees,” OR, 18(1138-1162).
T. C. HU, 1961, “The Maximum Capacity Route Problem,” OR, 9(898-900).
V. JARNIK, 1930, “O Jistém Problému Minimalnim,” Pracá Moravské Pr̆irodovĕdecké
Spolec̆nosti, 6(57-63), in Czech.
T. A. JENKYNS, 1986, “The Greedy Algorithm is a Shady Lady,” Congressus Nu-
merantium, 51(209-215).
D. B. JOHNSON, 1975, “Priority Queues with Update and Finding Minimum Span-
ning Trees,” IPL, 4(53-57).
A. KANG and A. AULT, Sept. 1975, “Some Properties of a Centroid of a True
Tree,” IPL, 4, no. 1(18-20).
A. N. C. KANG, R. C. T. LEE, C. CHANG, and S. K. CHANG, May 1977, “Stor-
age Reduction Through Minimal Spanning Trees and Spanning Forests,” IEEE
666 Ch. 9. Min. Cost Spanning Trees

Transactions on Computers, C-26, no. 5(425-434).


A. KERSHENBAUM, 1974, “Computing Capacitated Minimal Spanning Trees Ef-
ficiently,” Networks, 4, no. 4(299-310).
R. KIPP MARTIN, May 1986, “A Sharp Polynomial Size Linear Programming For-
mulation of the Minimum Spanning Tree Problem,” Graduate school of Business,
U. of Chicago.
J. B. KRUSKAL, 1956, “On the Shortest Spanning Subtree of a Graph and the
Traveling Salesman Problem ,” Proceedings of the AMS, 7(48-50).
I. LAVALLEE, 1984, “An Efficient Parallel Algorithm for Computing a Minimum
Spanning Tree,” Parallel Computing, 83(259-262).
I. LAVALLEE and G. ROUCAIROL, 1986, “A Fully Distributed (Minimal) Span-
ning Tree Algorithm,” IPL, 23(55-62).
B. M. MAGGS and S. A. PLOTKIN, Jan. 1988, “Minimum-cost Spanning as a
Path-Finding Problem,” IPL, 26, no. 6(291-293).
T. L. MAGNANTI and R. T. WONG, 1984, “Network Design and Transportation
Planning: Models and Algorithms,” TS, 18(1-55).
N. MEGIDDO, 1979, “Combinatorial Optimization with Rational Objective Func-
tions,” MOR, 4(414-424).
K. G. MURTY, R. SAIGAL, and J. SUURBALLE, 1974, “Ranking Algorithm for
Spanning Trees,” Bell labs. memo.
K. G. MURTY, H. HAMACHER, and F. MAFFIOLI, 1991, “Characterization of
the optimum face of the minimum cost spanning tree problem, and applications,”
Tech. report, IOE Dept., University of Michigan, Ann Arbor, Mich.
D. NATH and S. MAHESWARI, 1982, “Parallel Algorithms for the Connected
Components and Minimal Spanning Tree Problems,” IPL, 14, no. 1(7-11).
R. C. PRIM, 1957, “Shortest Connection Networks and Some Generalizations,”
Bell System Tech. J., 36(1389-1401).
P. M. SPIRA and A. PAN, 1975, “On Finding and Updating Spanning Trees and
Shortest Paths,” SIAM J. on Computing, 4(375-380).
R. E. TARJAN, 1982, “Sensitivity Analysis of Minimum Spanning Trees and Short-
est Path Trees,” IPL, 14(30-33).
Y. H. TSIN, April 1988, “On Handling Vertex Deletion in Updating Minimum
Spanning Trees,” IPL, 27, no. 4(167-168).
A. YAO, 1975, “An O(|E|log log |V |) Algorithm for Finding Minimum Spanning
Trees,” IPL, 4(21-23).
9.6. References 667

References on Steiner Tree Problems in Networks

Y. P. ANEJA, 1980, “An Integer Linear Programming Approach to the Steiner


Problem in Graphs,” Networks, 10(167-178).
S. E. DREYFUS and R. A. WAGNER, 1972, “The Steiner Problem in Graphs,”
Networks, 1(195-207).
E. N. GILBERT and H. O. POLLOCK, Jan. 1968, “Steiner Minimal Trees,” SIAM
J. Applied Math., 16, no. 1(1-29).
S. L. HAKIMI, 1971, “Steiner’s Problem in Graphs and Its Implications,” Networks,
1(113-133).
M. HANAN, Mar. 1966, “On Steiner’s Problem with Rectilinear Distance,” SIAM
J. Applied Math., 14, no. 2(255-265).
Z. A. MELZAK, 1961, “On the Problem of Steiner,” Canadian Mathematical Bul-
letin, 4(143-148).
R. T. WONG, 1984, “A Dual Ascent Approach for Steiner Tree Problems on a
Directed Graph,” MP, 28(271-287).

References on Optimum Branchings

F. BOCK, 1971, “An Algorithm to Construct a Minimum Directed Spanning Tree


in a Directed Network,” PP 29-44 in Developments in Operations Research, Gordon
and Breach, N.Y.
Y. J. CHU and T. H. LIU, 1965, “On the Shortest Arborescence of a Directed
Graph,” Sin. Sinica, 14(1396-1400).
J. EDMONDS, 1967, “Optimum Branchings,” J. Res. Nat. Bur. Standards, Sec-
tion B, 71(233-240).
R. M. KARP, 1971, “A Simple Derivation of Edmonds’ Algorithm for Optimum
Branchings,” Networks, 1(265-272).
R. E. TARJAN, 1977, “Finding Optimum Branchings,” Networks, 7(25-35).
Index

For each index entry we provide


the page number where it is de- Temporary labels 636
fined or discussed first.

Boruvka’s method 640


Branching 650

Greedy method 636


Selection 637
Worst case performance 643

Kruskal’s method 638

Min. length spanning trees


628
Constrained 630, 648
Linear representation 655
Optimum face 661
Unconstrained 630
Myopic method 636

Permanent labels 636


Prim’s method 636

Ranking method 645

Steiner 649
Points 649
Trees 649

668

You might also like