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

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)...
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.
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...
A 440-V, 3-φ 50-Hz, 4 poles, 37.3 kW, Y-connected induction motor has the following parameters: R1=...
A 440-V, 3-φ 50-Hz, 4 poles, 37.3 kW, Y-connected induction motor has the following parameters: R1= 0.1 Ω, X1 = 0.4 Ω , R2′ = 0.15 Ω , X2′ = 0.44 Ω Motor has stator core loss of 1250 W and rotational loss of 1000 W. It draws a no-load line current of 20 A at a p.f. of 0.09 (lag). When motor operates at a slip of 3%, calculate a. input line current and p.f. [57.4@29°A, 0.875 lag] b....
Atomicity of phosphorus is (a) 1 (b) 2 (c) 3 (d) 4
Atomicity of phosphorus is ________.(a) 1(b) 2(c) 3(d) 4
A B C D E F 1 Chapter 3: Applying Excel 2 3 Enter a formula...
A B C D E F 1 Chapter 3: Applying Excel 2 3 Enter a formula into each of the cells marked with a ? below 4 Review Problem: Activity-Based Costing 5         6 Data 7     Deluxe Tourist 8 Annual sales in units 2,000 10,000 9 Direct materials per unit $25 $17 10 Direct labor-hours per unit 5 4 11 12 Direct labor rate $12 per DLH 13 14 Estimated 15 Overhead Expected Activity 16 Activities and Activity...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT