Question: In this assignment, you are going to write a Java program to do the first part of the coloring algorithm. After you read data, you

In this assignment, you are going to write a Java program to do the first part of the coloring algorithm. After you read data, you are going to determine whether the graph is colorable using K colors where K is the second parameter from the command line. The following is the part of the algorithm that you need to implement in this assignment. Sort all the nodes based on the number of edges connected to that node If the minimum number of connected edges is larger than K, then output a message The graph is not K colorable and terminate the program; otherwise Push the node that has the fewest connected edges to a stack Remove the node that has the fewest connected edges Print out the updated graph Repeat until the graph is empty Using the first data file as an example, we have the input file as 6 0 0 1 0 0 1 0 0 1 0 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 0 >> java Color data1.txt 2 The output should be like 000000 001011 010111 001011 011101 011110 The graph is not 2 colorable ... >> java Color data1.txt 4 The output may look like the following 000000 001011 010111 001011 011101 011110 000000 000000 000111 001011 001101 001110 000000 000000 000000 000011 000101 000110 000000 000000 000000 000000 000001 000010 000000 000000 000000 000000 000000 000000 YOUR TASKS Write a Java program called Color The program should read two parameters from the command line o The first parameter is a data filename o The second parameter is the number of colors (K) o Implement this part of the algorithm described above o Write a note to describe how I can javac your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!