Reference no: EM132273592
Problem Statement:
For a given set of switches/bridges and their connections among each other, determine the spanning tree configuration for the active data-path among the switches, computed based on the spanning tree algorithm that we have learned.
To Do:
1. [Program-Input] Your program will run and read the inputs from the input.txt file. Each line in the input file is an individual problem.
For example, the first problem is given by input "5 R", which indicates that there are 5 switches and the connections among themselves are randomly (R) determined (by your "rational" program - example of "irrational" program will be the one which, may pick all switches with 0 connection most of the time - this will result in poor grade).
The second line indicates problem #2. Here, a set of individual connections to be solved among 5 switches which are given by "5 1-2 1-3 1-3 2-3 3-4 ...". Here the first digit "5" implies that there are 5 switches. Then, "1-2" indicates that switch#1 and switch #2 are physically connected by a wire. Note, by "1-3 1-3" it is indicated that switch #1 and switch #3 are physically connected twice: connection #1 is connecting port p2 (of switch #1) and p1 (of switch#3); whereas connection #2 is connecting p3 (of switch #1) and p2 (of switch #3). Here, p2 indicates port number #2 and so on.
The ports of a switch are to be connected/allocated from lower numbered port to higher numbered port for each connection by the order of the connection read from left to right for a given problem.
2. Your program will compute the corresponding spanning tree applying the algorithm discussed in the class (slides). As output, it will draw each round of intermediate configurations, including the final spanning tree configure at the end.
3. [Program-Output] Your outputs will print the problem configure first (such as "5 1-2 1-3 1-3 2-3 3-4 1-5 ..."). Then, it will draw the computed each round of intermediate configurations sequentially. Finally, it will draw the final spanning tree. The whole process to be done periodically for all the problem(s) given in the input file.
Guideline for coding
You will submit all your source code in a single java* file called SpanningTree.java. You may develop your code using separate files, but you will need to concatenate your source code together into a single compilable file for submission. The file SpanningTree.java should begin with a public class SpanningTree that contains the main program which takes the input file name as a command line argument and then performs the simulation of the given switch/bridge configuration problem in the input file. The public class SpanningTree should be followed by your other classes that comprise your system. Recall that Java will only allow one class within a source file to be declared public, so your SpanningTree.java source file will look something like this:
public class SpanningTree {
public static void main( String [] args ) {
... here lies code to process the input file and solving the Spanning Tree problem ...
}
}
Run your program and use the input.txt to get input as:
$ java SpanningTree input.txt
* If you are using programming language other than java, please adhere to the naming convention (e.g. SpanningTree.java can be SpanningTree.c)
Attachment:- CSCI 531 Computer Networks.rar