subject
Engineering, 23.11.2020 01:00 nancyy85

Consider an undirected graph G = (V, E), in which each node u 2 V may be colored with some color between 1 and C. Your task is to write a program that determine the colors for 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 integers 1 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 nodes are indicated with color 0. Output (Standard output): The first line contains an integer 0 D n that is the number 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 -- Output
9 18 -- 1
1 2 -- 1 2 3 2 3 1 3 1 2
1 3
1 4
1 7
2 3
2 5
2 8
3 6
3 9
4 5
4 6
4 7
5 6
5 8
6 9
7 8
7 9
8 9
0 2 0 2 0 1 0 1 0
Explain of the input/output: The nodes in the graph are equivalent to 9 squares as shown in the above figure. There is an edge between two squares if and only if they are on a same row or column. The initial coloring of the nodes in the graph is shown in the middle figure. 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 if you have multiple source files. Your program should not take more than 2 minutes to terminate 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 graphs assuming 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 the number of used colors and the maximum degree. Please give me answer in 2 Hours...

ansver
Answers: 1

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 18:10
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
question
Engineering, 04.07.2019 18:10
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
question
Engineering, 04.07.2019 18:20
Select any two (2) areas of applications of chain-drive. (clo4) a)-permanent lubrication necessary b)-hydraulic forklift truck operation c)-rigging and heavy moving materials d)-relatively high maintenance costs e)-costlier than belt drives
Answers: 2
You know the right answer?
Consider an undirected graph G = (V, E), in which each node u 2 V may be colored with some color bet...
Questions
Questions on the website: 13722361