As your instructor said it in class, there are many situations when you'll have to use your knowledge about graphs to solve real-life problems. The problem described here is one people in certain businesses (road-construction, communications, etc.) face all the time.
A complete description of the problem is included in a memo from your instructor.
A floppy disk (3.5") which contains the source file(s) for your program, a DOS executable named minspan and a README file indicating what the program does, how to build the executable, the platform it's been tested on, and how to run it, plus any other information you consider useful - like the name of the author, etc. Also two input files (use the extension .din for the name), you have used to test your program (with a minimum of four vertices each), and the corresponding output files (with the extension .out).
Please note that if your program reads input from standard input then it can get input from a file by using input redirection. Similarly, if the program writes to standard output, then the output can be easily written to a file by using output redirection.
For each business day you turn in your project earlier you receive a
5% bonus. However, penalties increase by 5% as well. You can turn in your
assignment up to ten business days ahead of the deadline.
You may be asked to do a code review with your instructor.
|DATE:||February 16, 1998|
A business in Chicago -- they do networking -- has asked me to find a solution to their problem. I pass the problem on to you and I just add some details about input ond output formats. The problem can be modelled as a graph problem. What you have to do is to write a general program that takes a description of a connected graph from standard input, finds the shortest system of edges in the graph such that any two vertices are connected, and prints the result out to standard output.
Here is a description for the input and the output of your program.
Each line in the input will give the names of two vertices in the graph and the weight of the edge connecting them. For simplicity vertex names are non-negative integers. Weights are non-negative integers as well.
There must be at least two vertices, the graph must be connected and each edge may be listed only once. Your program must enforce these rules.
Here is an example of input for a graph with three vertices:
0 1 21 1 2 17 2 0 16
The output will contain one line for each edge in the solution. The output line contains the names of the vertices being connected (the order in which they are listed is not important), followed by the weight of the edge connecting them. The final line should be a sentence indicating the total weight. Here is the output corresponding to the sample input above:
1 2 17 0 2 16 Total weight: 33
|(c) 1997, Virgil Bistriceanu||Last update: February 16, 1998||The cs330 home page|