
(Last Revision: 11/16/97)

//////////////////////////////////////////////////
CS 3100 PROGRAMMING ASSIGNMENT #05
-- MINIMUM COST SPANNING TREE 
//////////////////////////////////////////////////

++++++++++++++++++++++++++++++++++++++++
Finished Program DUE Monday, December 8
(You will not turn in a preliminary
 version of this program.)
++++++++++++++++++++++++++++++++++++++++

For this assignment, you will create a program that inputs a
list of weighted graph edges.  We assume that the list
describes a connected, undirected graph.

The program will:

1. echo the input,
2. print a sublist of the input list, describing a minimal cost
   spanning tree of the input graph, and
3. report the total cost of the minimal cost tree (the sum of
   the weights of the edges in the tree.)

Here is a sample script:
=================================================================
Script started, file is typescript
john@barnard: cat edgeList
DurangoCO   RatonNM   276
DurangoCO   SantaFeNM   214
DurangoCO   AlbuquerqueNM   212
RatonNM   TucumcariNM   177
TucumcariNM   AlbuquerqueNM   174
TucumcariNM   AmarilloTX   110
RatonNM   AmarilloTX   205
RatonNM   SantaFeNM   168
SantaFeNM   TucumcariNM   166
AmarilloTX   GuymonOK   125
GuymonOK   RatonNM   188
john@barnard: a.out < edgeList
The input is:
DurangoCO    RatonNM    276
DurangoCO    SantaFeNM    214
DurangoCO    AlbuquerqueNM    212
RatonNM    TucumcariNM    177
TucumcariNM    AlbuquerqueNM    174
TucumcariNM    AmarilloTX    110
RatonNM    AmarilloTX    205
RatonNM    SantaFeNM    168
SantaFeNM    TucumcariNM    166
AmarilloTX    GuymonOK    125
GuymonOK    RatonNM    188

The Minimum Spanning Tree is:
AlbuquerqueNM   DurangoCO   212
AlbuquerqueNM   TucumcariNM   174
AmarilloTX   TucumcariNM   110
AmarilloTX   GuymonOK   125
SantaFeNM   TucumcariNM   166
RatonNM   SantaFeNM   168

The total cost is:        955
john@barnard: exit
john@barnard: Script done, file is typescript
=================================================================

Use the algorithm on pp. 367-368 of your textbook as the basis
for the main algorithm of your program.  The algorithm requires
the use of the following auxiliary data structures: string,
heap, priority queue, and graph (adjacency-list
implementation).  I have provided code for these data
structures in Pascal and C versions.  You are receiving most of
the code in handouts.  The string code and the p2c.h file is in
the class gopher space.

The Pascal code is near-perfect for this application -- it will
fit together to form the program you are writing with little or
no modification.  The C-code modules are machine translations of
the Pascal code.  They will require some more modification, but
very little more.  The string.c file may not be worth the
trouble it takes to get it working.  The C programmers may wish
to use other code for doing the string handling.  The lgraph
code calls operations in the string code.  C programmers who do
not use string.c will have to replace those calls with calls to
other operations that can do the required work.

