Question: This is a question from textbook Algorithm Design Chapter 6 Exercise 1 https://www.chegg.com/homework-help/Algorithm-Design-1st-edition-chapter-6-problem-1E-solution-9780321295354 Let G = (V, E) be an undirected graph with n nodes.
This is a question from textbook "Algorithm Design" Chapter 6 Exercise 1
https://www.chegg.com/homework-help/Algorithm-Design-1st-edition-chapter-6-problem-1E-solution-9780321295354


Let G = (V, E) be an undirected graph with n nodes. Recall that a subset of the nodes is called an independent set if no two of them are joined by an edge. Finding large independent sets is difficult in general; but here we'll see that it can be done efficiently if the graph is "simple" enough. Call a graph G = (V. E) a path if its nodes can be written as v1, v2, ,vn, with an edge between vi and vj if and only if the numbers i and j differ by exactly 1. With each node vi, we associate a positive integer weight wi. Consider, for example, the five-node path drawn in Figure 1. The weights are the numbers drawr inside the nodes. The goal in this question is to solve the following problem: Find an independent set in a path G whose total weight is as large as possible. (a) Give an example to show that the following algorithm does not always find an independent set of maximum total weight. The "heaviest-first" greedy algorithm Start with S equal to the empty set While some node remains in G Pick a node vi of maximum weight Add v to S Delete V and its neighbors from G Endwhile Return ;S
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
