Строительный блокнот  Automata methods and madness 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 [ 152 ] 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175

AllofSS-


Figure 10.12: Reductions among NP-complete problems

10.4.7 Exercises for Section 10.4

* Exercise 10.4.1: A k-digue in a graph G is a set of к nodes of G such that there is an edge between every two nodes in the clique. Thus, a 2-clique is just a pair of nodes connected by an edge, and a 3-clique is a triangle. The problem CLIQUE is: given a graph G and a constant k, does G have a fc-clique?

a) What is the largest к for which the graph G of Fig. 10.1 satisfies CLIQUE?

b) How many edges does a fc-clique have, as a function of A?

c) Prove that CLIQUE is NP-complete by reducing the node-cover problem to CLIQUE.

*! Exercise 10,4.2: The coloring problem is: given a graph G and an integer k, is G A:-colorable j that is, can we assign one of к colors to each node of G in such a way that no edge has both of its ends colored with the same color. For



example, the graph of Fig. 10.1 is 3-colorable, .since we can assign nodes 1 and 4 the color red, 2 green, and 3 blue. In general, if a graph has a fc-clique, then it can be no less than fc-colorable, although it might require many more than fc colors.


Figure 10.13: Part of the construction showing the coloring problem to be NP-complete

In this exercise, we shall give part of a construction to show that the coloring problem is NP-complete; you must fill in the rest. The reduction is from 3SAT. Suppose that we have a 3-CNF expression with n variables. The reduction converts this expression into a graph, part of which is shown in Fig. 10.13. There are, as seen on the left, n + l nodes co, ci .., c that form an {n+ 1)-clique. Thus, each of these nodes must be colored with a different color. We should think of the color assigned to Cj as the color Cj.

Also, for each variable Xj, there are two nodes, which we may think of as Xi and ж7. These two are connected by an edge, so they cannot get the same color. Moreover, each of the nodes for Xj are connected to cj for all j other than 0 and i. As a result, one of Xi and Щ must be colored co, and the other is colored c;. Think of the one colored co as true and the other as false. Thus, the coloring chosen corresponds to a truth assignment.

To complete the construction, you need to design a portion of the graph for each clause of the expression. It should be possible to complete the coloring of the graph using only the colors cg through c if and only if eacli clause is made true by the truth assignment corresponding to the choice of colors. Thus, the constructed graph is (n -b l)-colorable if and only if the given expression is satisfiable.




Figure 10.14: A graph

Exercise 10.4.3: A graph does not have to be too large before NP-complete questions about it become very hard to solve by hand. Consider the graph of Fig. 10.14.

* a) Does this graph have a Hamilton circuit?

b) What is the largest independent set?

c) What is the smallest node cover?

d) What is the smallest edge cover (see Exercise 10.4.4(c))?

e) Is the graph 2-colorable?

Exercise 10.4,4: Show the following problems to be NP-complete:

a) The subgraph-isomorphism problem: given graphs Gi and G2, does Gi contain a copy of G2 as a subgraph? That is, can we find a subset of the nodes of Gi that, together with the edges among them in Gi, forms an exact copy of G2 when we choose the correspondence between nodes of G2 and nodes of the subgraph of Gi properly? Hint: Consider a reduction from the clique problem of Exercise 10.4.1.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 [ 152 ] 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175