a. As already stated in the hint, we can number of each of the vertices as follows:-
1. Get the optimal colouring of the graph.
2. For each colour c used in optimal coloring, do the following:-
3............. For each of the vertices in graph G with color c, number them in contigous sequence
4. Color the vertices in the graph in the ascending sequence of number.
In above strategy, graph will have optimal coloring because the color assigned by Greedy algorithm will be exactly as per optimal coloring
b. No this algorithm will not always yield optimal result because this algorithm solely depends upon optimal result of graph coloring, which is not available to us and hence we will not be able to get the optimal result by whimsically numbering the vertices in arbitrary way.
c. Since any bipartite graph is always 2-colorable, Greedy algorithm will give the optimal result because once one vertex in any set say SET1 is assigned color 1, then all its neightbors in other set i.e. SET2 will be assigned color 2 and after that remaining vertices in SET1 will be assigned color 1 because none of its neighbor have color 1. Hence complete bipartite graph will always be 2-colorable by this Greedy algorithm.
Please comment for any clarification.
a) Prove that by correctly numbering the vertices of your graph, the greedy colouring algorithm will...
Question 2. Use the greedy algorithm to color the graph below, ordering the vertices alphabetically. Is this coloring optimal? How do you know?
Question 2. Use the greedy algorithm to color the graph below, ordering the vertices alphabetically. Is this coloring optimal? How do you know?
COMP Discrete Structures: Please answer completely and
clearly.
(3).
(5).
x) (4 points) If k is a positive integer, a k-coloring of a graph G is an assignment of one of k possible colors to each of the vertices/edges of G so that adjacent vertices/edges have different colors. Draw pictures of each of the following (a) A 4-coloring of the edges of the Petersen graph. (b) A 3-coloring of the vertices of the Petersen graph. (e) A 2-coloring (d) A...
Give an example of a graph G with at least 10
vertices such that the greedy 2-approximation algorithm for
Vertex-Cover given below is guaranteed to produce a suboptimal
vertex cover.
Algorithm Vertex CoverApprox(G): Input: A graph G Output: A small vertex cover C for G while G still has edges do select an edge e (v, w) of G add vertices v and w to C for each edge f incident to v or w do remove f from G...
Question 2. (15 points; CLO #2): Prove that Prim's greedy algorithm correctly finds the minimum spanning tree when applied to a given undirected weighted graph.
Bipartite graph is a graph, which vertices can be partitioned into 2 parts - so that all edges connect only vertices from different parts. For example, this is a bipartite graph where one part has 3 vertices (a,b,c), and the other part - 4 vertices (d.e.f.g). Note there are NO edges in-between vertices coming from the same part. a b d f e g Give the order in which nodes are traversed with BFS. After listing a node, add its...
1) Design a greedy algorithm that solves the problem; describe your algorithm with clear pseudocode; and prove the time efficiency class of your algorithm: If x, y are two adjacent elements in a sequence, with x before y, we say that the pair x, y is in order when x <= y and the pair is out of order when x > y. For example, in the string “BEGGAR” the pair G, A are out of order, but all the...
Answer each question in the space provided below. 1. Draw a simple graph with 6 vertices and 10 edges that has an Euler circuit. Demonstrate the Euler circuit by listing in order the vertices on it. 2. For what pairs (m,n) does the complete bipartite graph, Km,n contain an Euler circuit? Justify your answer. (Hint: If you aren't sure, start by drawing several eramples) 3. For which values of n does the complete graph on n vertices, Kn, contain a...
Please write a python function for :
greedy: This function takes two inputs: one a graph, and the other an ordering of the vertices as a list, and returns the proper vertex-coloring produced by the greedy algorithm over the ordering in the list. Examples: greedy({"A" : ["B", "C"], "B" : ["A"], "C" : ["A"]},[“A”, “B”, “C”]) should return {“A” : 1, “B” : 2, "C" : 2} greedy({“A” : ["B"], "B" : [“A”, “C”],"C" : [“B”, “D”), “D" : ["C"]},[“A”,...
2) Let G ME) be an undirected Graph. A node cover of G is a subset U of the vertex set V such that every edge in E is incident to at least one vertex in U. A minimum node cover MNC) is one with the lowest number of vertices. For example {1,3,5,6is a node cover for the following graph, but 2,3,5} is a min node cover Consider the following Greedy algorithm for this problem: Algorithm NodeCover (V,E) Uempty While...
Consider a directed acyclic graph G = (V, E) without edge lengths and a start vertex s E V. (Recall, the length of a path in an graph without edge lengths is given by the number of edges on that path). Someone claims that the following greedy algorithm will always find longest path in the graph G starting from s. path = [8] Ucurrent = s topologically sort the vertices V of G. forall v EV in topological order do...