Consider an undirected graph G = (V,E), in which each node u 2 V may be coloredwith some color between 1 and C. Your task is to write a program that determine the colorsfor the uncolored nodes in the graph such that• For all edges (u, v) 2 E, u and v have different colors.• The number of additional colors needed is minimum.Input (Standard input): Includes multiples lines. The first line contains two integers1 n 1000, 1 m 100000 that correspond to the number of nodes and edges,respectively.Each of the following m lines contain two integers u and v, separated by one space,to denote an edge from u to v. Nodes are numbered from 1 to n.The last line contains n integers that are the colors of the nodes. Uncolored nodesare indicated with color 0.Output (Standard output): The first line contains an integer 0 D n that is thenumber of additional colors needed to color all the uncolored nodes in the graph.The next line contains n positive integers that are colors of the nodes.Sample input/output:Input — Output9 18 — 11 2 — 1 2 3 2 3 1 3 1 21 31 41 72 32 52 83 63 94 54 64 75 65 86 97 87 98 90 2 0 2 0 1 0 1 0Explain of the input/output: The nodes in the graph are equivalent to 9 squares asshown in the above figure. There is an edge between two squares if and only if they are ona same row or column. The initial coloring of the nodes in the graph is shown in the middlefigure. We can use one additional color (color 3) to color all the remaining nodes.I. Your program in Java/C++ that solves the above problem following the above input/output format. A makefile and/or compiling instruction should be included ifyou have multiple source files. Your program should not take more than 2 minutes toterminate on any graph within the limits described in the Input section.II. A report outline the numbers of colors used by your program on random graphsassuming no nodes have any color at the beginning. The report should have at least two parts. Run your program for graphs of sizes 50, 100,…, 500 and report both thenumber of used colors and the maximum degree.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more