Question: [ 1 0 marks ] 2 . Write a program that codes the greedy coloring algorithm. You should input a Graph and output a list

[10 marks]2. Write a program that codes the greedy coloring algorithm. You should input a Graph and output a list of colors, so that color_graph[i]=\#the color of vertex i. Once you have written your code, determine it's complexity (see CISC121 or Ch 3. of Rosen).
You have a line limit of 60 lines (If you really all need more, let me know, but 60 should be enough).
You should consider a graph \( G=(V, E)\) is stored as a list of vertices V \(=[\mathrm{v}1,\mathrm{v}2,\ldots,\mathrm{vn}]\) and n-length list, and a list of tuples for the edges \( E=[(v i, v j),(v i, v j)]\). You do not need to define any classes or import any packages. Note that the edges are NOT directed so the edge from \( u \) to \( v \) may be stored as either (\(\mathrm{u},\mathrm{v}\)) or (\(\mathrm{v},\mathrm{u}\))
Note: it may be beneficial to create a list or dictionary of neighbors.
[ 1 0 marks ] 2 . Write a program that codes the

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 Programming Questions!