CSCI203/803 Data Structures and Algorithms Assignment 3  Input/output Format Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (7 votes)

✔✔✔✔✔

Input

You program should read an input file name from the command line and uses the adjacency matrix read from the input file with a format as follows.

  • The integer number of vertices in the graph.
  • The positive real number weights of one vertex per line, delimited by a space. The value 0.0 is used as no connection.

 

A sample input file can be created using the provided program, generateAdjM.cpp. You may use the program directly, or adapt it, to create graphs for your algorithms without modifying the output format. If you adapt the program to generate adjacency matrices of different characteristics, you should add a header to the code to explain what you have modified.  Output

 MST output

The MST from each algorithm should be saved in a text output file named with prefix, output_mst_*.txt, that contains the edges of MST as a sequence of edges, in selected order using the algorithm * from node 1, each edge and its weight per line and the minimal weight at the last line. Algorithm 1 is always for the brute-force algorithm and algorithm 2 and so on for your other algorithms. For instance,

1-4 2.3

4-3 1.9

4-2 3.2  …

4-2 3.2

45.6

 Statistics output

The output should be displayed to standard output. For each algorithm, the output should consist of the following data, clearly labelled: (CSCI203 students only have one output for Prim’s algorithm.)

Number of vertices: **

  1. Brute-force algorithm 1: *** (time unit)
  2. Prim’s algorithm 2 (matrix): *** (time unit)
  3. Prim’s algorithm 3 (heaps): *** (time unit)

You may save this information to a file for your analysis and easy plotting later.

  • Assinment3.zip