MinimumCost Spanning

as a

PathFinding Problem

Bruce M Maggs Serge A Plotkin

Laboratory for Computer Science

MIT

Cambridge MA

July

Abstract

In this pap er we show that minimumcost spanning tree is a sp ecial case of the closed semiring

pathnding problem This observation gives us a nonrecursive algorithm for nding minimum

cost spanning trees on meshconnected computers that has the same asymptotic running time

but is much simpler than the previous recursive algorithms

Intro duction

In this pap er we show that minimumcost spanning tree is a sp ecial case of the closed semiring

pathnding problem sections For a graph of n vertices the pathnding problem can

3

b e solved sequentially in O n steps by a dynamic programming algorithm of which the

algorithms of Floyd and Warshall are sp ecial cases This dynamic programming algorithm

has a well known O n step implemen tation on an n n meshconnected computer

Previously known minimumcost spanning tree algorithms for the mesh are based on the

recursive algorithm of Boruvka also attributed to Sollin pp which is complicated to

implemen t For example the algorithm of achieves O n steps by reducing the fraction of the

mesh in use by a constant factor at each recursive call The dynamic programming algorithm has

the same asymptotic running time but is much simpler

0

This research was supp orted in part by the Defense Advanced Research Pro jects Agency under Contract N

C and by the Oce of Naval Research under Contract NK Bruce Maggs is supp orted in

part by an NSF graduate fellowship

The rest of this pap er consists of two short sections In section we show how to cast minimum

cost spanning tree as a pathnding problem In section we briey describ e an O n step mesh

algorithm to solve the problem

Minimumcost spanning tree

In this section we dene the minimumcost spanning tree problem and a related pathnding prob

lem We give a recurrence for solving the pathnding problem via dynamic programming We

then prove that the solution to the pathnding problem contains the solution to the minimumcost

spanning tree problem

1

Given an nno de connected undirected graph G V E where V is the set f ng and

0 0

the minimumcost spanning tree problem is to nd a C where each edge fi j g in E has cost C

j i ij

subgraph that connects the vertices in V such that the sum of the costs of the edges in the subgraph

is minimum We assume that the edge costs are unique If not lexicographical information can

b e added to make them unique For convenience we also assume that if fi j g is not in E then it

0 0

C has cost C

j i ij

k

for each i j k n of the shortest The pathnding problem is to compute the cost C

ij

lowestcost path from i to j that passes through vertices only in the set f k g where the cost

of a path is dened to be the highest cost of any edge on the path For any i and j the shortest

path from i to j with no intermediate vertex higher than k either passes through k or do es not In

the rst case the cost of the shortest path from i to j is either the cost of the shortest path from i

to k or the cost of the shortest path from k to j whichever is higher In the second case we have

k 1

k k

C C Thus C can b e computed by the recurrence

ij ij

ij

k 1 k k 1 k 1

gg C min fC C maxfC

ij

ij

k j ik

The following theorem shows that the unique minimumcost spanning tree can b e recovered

from the costs of the shortest paths

0 n

Theorem An edge fi j g is in the unique minimumcost spanning tree if and only if C C

ij ij

1

For simplicit y we assume that the graph is connected The same technique will nd a minimumcost spanning

forest of a disconnected graph

0 n

Pro of The pro of has two parts We rst show that if fi j g is a tree edge then C C We

ij ij

0 n

then show that if C C then the edge fi j g is in the tree First assume that fi j g is a tree

ij ij

0 n

edge but that C C Consider the cut of the graph that fi j g crosses but no other tree edge

ij ij

0 n

crosses Since C C there must b e some path from i to j whose highestcost edge has cost

ij ij

n 0 0

C C Hence every edge on this path has cost less than C This path must cross the cut at

ij ij ij

least once Replacing the edge fi j g by any edge on the path that crosses the cut reduces the cost

0 n

of the tree a contradiction Conversely assume that C C but that fi j g is not a tree edge

ij ij

0

Adding the edge fi j g to the tree forms a whose highestcost edge costs more than than C

ij

Replacing this edge by fi j g yields a tree with smaller cost a contradiction

Implementation on a meshconnected computer

In this section we give a short description of an O n step algorithm for solving the minimumcost

spanning tree problem on an n n meshconnected computer We assume that the diagonal element

in each mesh row can broadcast a value to the other elements of the row in a single step This type

of broadcast can b e simulated by a mesh without this capability by slowing the algorithm down by

a constant factor The algorithm pro ceeds as follows We assume that the input graph

0

is given in the form of a of edge costs C which enters rowbyrow through the top of the

mesh Matrix row i is mo died as it passes over rows through i and is stored when it reaches

k 1

is broadcast right and left mesh row i When matrix row i passes over mesh row k the value C

ik

k 1

from the diagonal cell k k Each cell k j j n knows the value of C and computes

k j

k 1 k 1 k 1

k

maxfC C gg C min fC

ij

ij

ik k j

which is passed down to the next mesh row After reaching mesh row i matrix row i stays there

until each matrix row l i l n ab ove it has passed over it and then continues to propagate

n

down passing over the rest of the matrix rows The output matrix C exits rowbyrow from the

b ottom of the mesh By theorem the adjacency matrix of the minimumcost spanning tree can

b e constructed by comparing the input and output matrices

Acknowledgments

We would like to thank Tom Leighton and Charles Leiserson for their helpful suggestions

References

A V Aho J E Hop croft and J D Ullman The Design and Analysis of Computer Algorithms

AddisonWesley Reading MA

M J Atallah and S R Kosara ju Graph problems on a meshconnected pro cessor array

Journal of ACM July

T W Christopher An implementation of Warshal ls algorithm for transitive closure on a

cellular computer Technical Rep ort Inst for Comp Research Univ of Chicago Chicago

IL

E Dekel D Nassimi and S Sahni Parallel matrix and graph algorithms SIAM Journal on

Computing November

R W Floyd Algorithm shortest path Communications of the ACM

L J Guibas H T Kung and C D Thompson Direct VLSI implemen tation for combinatorial

algorithms In Proc of the Caltech Conference on Very Large Scale Integration pages

January

S C Kleene Representation of events in nerve nets and nite automata In C E Shannon

and J McCarthy editors Automata Studies pages Princeton University Press

F T Leighton Introduction to the Theory of Networks Parallel Computation and VLSI

Design Unpublished manuscript

C E Leiserson F M Rose and J B Saxe Optimization of synchronous circuitry by retiming

In Third Caltech Conference on VLSI pages March

C E Leiserson and J B Saxe Optimizing synchronous systems Journal of VLSI and

Computer Systems Spring

K N Levitt and W H Kautz Cellular arrays for the solution of graph problems Communi

cations of the ACM September

R McNaughton and H Yamada Regular expressions and state graphs for automata IRE

Trans on Electronic Computers

F L Van Scoy The parallel recognition of classes of graphs IEEE Transactions on Computers

C July

RE Tarjan Data Structures and Network Algorithms SIAM Philadelphia PA

S Warshall A theorem on b o olean matrices Journal of ACM