Question

In: Computer Science

GVC_E(V,E) 1. C =Φ 2. while ( E≠ Φ) 3. do 4. { select an edge...

GVC_E(V,E)

1. C =Φ

2. while ( E≠ Φ)

3. do

4. { select an edge (u,v)∈E;

5. C = C∪{u}∪{v};

6. delete u and v from V and edges with u or v as an endpoint from E;

7. }

8. for each u∈C

9. { if C\{u} is a valid cover;

10. C = C\{u};

11. }

How can I complete the pseudo code on line 4 and line 8 by adding a heuristic specifying how to select a node

Solutions

Expert Solution

Here in both line 4 and 8, there is no such heuristic. You can select any arbitrary edge in line 4 among all the remaining edges available on your graph, to add its vertices for vertex cover. And similarly you can select any vertex u in line 8 to check whether its removal will still let set C to be a vertex cover.

However this is Greedy algorithm, we can select edge e = (u,v) in line 4 such that vertex u and vertex v has maximum possible degree.

Consider 2 graphs shown below:-

Here in the left side graph, if we remove edge (u,v) where sum of degree of vertices u and v is maximum and add vertex u and v i.e. {u,v} as greedy choice of edge-cover then this strategy is giving optimal result.

But in the right side graph, if we remove edge (u,v) as per the Greedy choice, then we will be left with 6 vertices and 3 edges (u1,v1), (u2, v2) and (u3,v3) and this Greedy algorithm will select all the vertices in each of these edges as the edge cover and hence the edge cover will be {u,v, u1,v1, u2, v2 u3,v3 } which is the worst choice while the optimal choice is {u, u1 , u2, u3} .

This example shows that Greedy strategy will not give optimal result.


Related Solutions

2CCA : E-Discovery: Don't Be Afraid to Be Smart—Select While You Collect ? 2-3 paragraphs in...
2CCA : E-Discovery: Don't Be Afraid to Be Smart—Select While You Collect ? 2-3 paragraphs in length
You are given an undirected graph G = ( V, E ) in which the edge...
You are given an undirected graph G = ( V, E ) in which the edge weights are highly restricted. In particular, each edge has a positive integer weight from 1 to W, where W is a constant (independent of the number of edges or vertices). Show that it is possible to compute the single-source shortest paths in such a graph in O(E+V) time.
1) Determine the angle between vectors: U = <2, -3, 4> and V= <-1, 3, -2>...
1) Determine the angle between vectors: U = <2, -3, 4> and V= <-1, 3, -2> 2) determine the distance between line and point P: -2x+3y-4z =2 L: 3x – 5y+z =1 3) Determine the distance between the line L and the point A given by L; (x-1)/2 = (y+2)/5 = (z-3)/4 and A (1, -1,1) 4) Find an equation of the line given by the points A, B and C. A (2, -1,0), B (-2,4,-1) and C ( 3,-4,1)...
E=1/2 CV^2 E= 1/2 (164 microF) (10^-6 F) (119 V)^2 E= 1.168 J How do you...
E=1/2 CV^2 E= 1/2 (164 microF) (10^-6 F) (119 V)^2 E= 1.168 J How do you figure out the J from the F V^2   
For the following exercises, calculate u ⋅ v. Given v = 〈−3, 4〉 draw v, 2v, and 1/2 v.
For the following exercises, calculate u ⋅ v.Given v = 〈−3, 4⟩ draw v, 2v, and 1/2 v.
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0...
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0 for any e in E, and a source vertex s. Use Dijkstra’s algorithm to calculate distance(s,v) for all of the vertices v in V. (You can implement your own priority queue or use the build-in function for C++/Python) # Input The graph has `n` vertices and `m` edges. There are m + 1 lines, the first line gives three numbers `n`,`m` and `s`(1 <=...
A B C D E F 1 Chapter 8: Applying Excel 2 3 Data 4 Exhibit...
A B C D E F 1 Chapter 8: Applying Excel 2 3 Data 4 Exhibit 8-8: Standard Cost Card 5 Inputs Standard Quantity Standard Price 6 Direct materials 3.0 pounds $4.00 7 Direct labor 0.50 hours $22.00 per hour 8 Variable manufacturing overhead 0.50 hours $6.00 per hour 9 10 Actual results: 11     Actual output 2,090 units 12     Actual variable manufacturing overhead cost $6,174 13    Actual Quantity Actual price 14     Actual direct materials cost 6,115 pounds $3.9 pounds...
For the following exercises, given v, draw v, 3v and 1/2 v. 〈−1, 4〉
For the following exercises, given v, draw v, 3v and 1/2 v.⟨−1, 4⟩
For the following exercises, given v, draw v, 3v and 1/2 v. 〈−3, −2〉
For the following exercises, given v, draw v, 3v and 1/2 v.⟨−3, −2⟩
SE-FamilySize 1 1 4 3 2 4 2 3 4 2 4 1 4 2 2...
SE-FamilySize 1 1 4 3 2 4 2 3 4 2 4 1 4 2 2 4 5 4 5 4 4 2 4 3 1 2 3 5 5 5 Make a confidence interval. Be sure you show all the steps you took. Include a screen shot of any applet you used in your calculations. 2. Choose a confidence level (1 – α). 3. What is xbar? 4. What is s? 5. What is t? (Show a screen shot...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT