Show that the following problem is NP-Complete (Hint: reduce from 3-SAT or Vertex Cover).
Given an undirected graph G with positive integer distances on the edges, and two integers f and d, is there a way to select f vertices on G on which to locate firehouses, so that no vertex of G is at distance more than d from a firehouse?
To show that a given problem is NP-complete, we need to show that the problem belongs to the class NP (i.e., a candidate solution for the problem can be verified in polynomial time) and there is another known NP-complete problem which can be reduced to the current problem in polynomial time.
In the current problem, we first transform the given graph G into a new graph G’ (pronounced G-prime). Let V denote the vertex set and E denote the edge set of the original graph G. Analogously, let V’ and E’ denote the vertex and edge sets of the new graph G’.
While transforming G into G’, we use the same vertex set, i.e., V = V’. However, we add an edge between two vertices u’ and w’ in G’ only if the corresponding vertices u and w in the original graph G are connected by an edge with distance less than d (Note d is the parameter given in the question). So the newly transformed graph G’ will connect only those vertices which have the distance at most d (i.e., d or less than d). Note in the newly created graph G’, we do not need to label the edges in E’ with the distance because all of those edges will have distance less than or equal to d.
Now, to know “is there a way to select f vertices on G on which to locate firehouses, so that no vertex of G is at distance more than d from a firehouse?”, all that we need to do is to run an algorithm for solving the Vertex Cover problem in the newly transformed graph G’. That is, if there is a vertex cover of size f or less than f in the new graph G’, then the vertices in the vertex cover of G’ give us the way to select the f vertices in the original graph G to locate the firehouses (so that no vertex in G is at distance d or more from a firehouse).
Note that finding a Vertex Cover of an undirected graph is an already known NP-complete problem (as mentioned in the question itself. See the Hint.). We have provided a polynomial time transformation from the Vertex cover problem to the problem given in the question. Thus we have reduced a known NP-complete problem (i.e., Vertex cover) to this problem. We have also shown that this problem is in class NP because if someone provides us a set of candidate f vertices in the original graph G, we can easily verify in polynomial time that remaining vertices of G (original graph) are at a distance d or less from these candidate vertices.
Thus, we have proved both conditions necessary to show that this is an NP-complete problem. Hence the proof.
Show that the following problem is NP-Complete (Hint: reduce from 3-SAT or Vertex Cover). Given an undirected graph G wi...
Note: For the following problems, you can assume that INDEPENDENT SET, VERTEX COVER, 3-SAT, HAMILTONIAN PATH, and GRAPH COLORING are NP-complete. You, of course, may look up the defini- tions of the above problems online. 5. The LONGEST PATH problem asks, given an undirected graph G (V, E), and a positive integer k , does G contain a simple path (a path visiting no vertex more than once) with k or more edges? Prove that LONGEST PATH is NP-complete.
Note:...
Prove that the following problem is NP-complete: given an undirected graph G = (V, E) and an integer k, return a clique of size k as well as an independent set of size k, provided both exist.
Question 1: Given an undirected connected graph so that every edge belongs to at least one simple cycle (a cycle is simple if be vertex appears more than once). Show that we can give a direction to every edge so that the graph will be strongly connected. Question 2: Given a graph G(V, E) a set I is an independent set if for every uv el, u #v, uv & E. A Matching is a collection of edges {ei} so...
Solve (a) and (b) using BFS and DFS diagram
BFS Given an undirected graph below (a) Show the shortest distance to each vertex from source vertex H and predecessor tree on the graph that result from running breadth-finst search (BFS).Choose adjacen vertices in al phabetical order b) Show the start and finsh time for each vertex, starting from source vertex H, that result from running depth-first search (DFS)Choose aljacent vertices in alphabet- ical order DFS
BFS Given an undirected graph...
BFS Given an undirected graph below (a) Show the shortest distance to each vertex from source vertex H and predecessor tree on the graph that result from running breadth-finst search (BFS).Choose adjacen vertices in al phabetical order b) Show the start and finsh time for each vertex, starting from source vertex H, that result from running depth-first search (DFS)Choose aljacent vertices in alphabet- ical order DFS
BFS Given an undirected graph below (a) Show the shortest distance to each vertex...
Show the operation of depth-first search (DFS) on the graph of Figure 1 starting from vertex q. Always process vertices in alphabetical order. Show the discovery and finish times for each vertex, and the classification of each edge. (b) A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first search (BFS) tree can also be used to classify the edges reachable from the source of the search into the same four categories....
Input: a directed grid graph G, a set of target points S, and an integer k Output: true if there is a path through G that visits all points in S using at most k left turns A grid graph is a graph where the vertices are at integer coordinates from 0,0 to n,n. (So 0,0, 0,1, 0,2, ...0,n, 1,0, etc.) Also, all edges are between vertices at distance 1. (So 00->01, 00->10, but not 00 to any other vertex....
The Max Cut problem is given a undirected graph G(V, E), finding a set S so that the number of edges that go between S and V − S is maximum. This is an NPC problem. a) Show that there is always a max cut of size at least |E|/2. Hint: Decide where to put vertices according to if they have more neighbors in S or V − S.
Definition: Given a Graph \(\mathrm{G}=(\mathrm{V}, \mathrm{E})\), define the complement graph of \(\mathrm{G}, \overline{\boldsymbol{G}}\), to be \(\bar{G}=(\mathrm{V}, E)\) where \(E\) is the complement set of edges. That is \((\mathrm{v}, \mathrm{w})\) is in \(E\) if and only if \((\mathrm{v}, \mathrm{w}) \notin \mathrm{E}\) Theorem: Given \(\mathrm{G}\), the complement graph of \(\mathrm{G}, \bar{G}\) can be constructed in polynomial time. Proof: To construct \(G\), construct a copy of \(\mathrm{V}\) (linear time) and then construct \(E\) by a) constructing all possible edges of between vertices in...
6) Below is an adjacency matrix for an undirected graph, size n- 8. Vertices are labeled 1 to 8 Rows are labeled 1 through 8, top to bottom. Columns are labeled 1 through 8, left to right. Column labels to the right: 1 2 345 6 78 Row labels are below this: 1 0 0 1 000 0 0 2 0 0 101 1 00 (See a drippy heart?) 3 1 1 0 1 01 0 0 4 0 0...