- LXS
Let 2-CNF-SAT be the set of satisfiable Boolean formula in CNF with exactly 2 literals per clause. Show that 2-CNF-SAT ∈ P. Make your algorithm as efficient as possible. (Hint: Observe that x ∨ y is equivalent to ¬x → y. Reduce 2-CNF-SAT to an efficiently solvable problem on a directed graph.)
將一個Boolean formula,其中有n個Boolean variable、m個calause,轉成一個directed graph,每個Boolean variable,對應圖中點 共2n個點,每個calause 相當於,對於圖中我們也連接與共個點共2m個邊。
首先找strongly connected components,需要時間,然後確保每個與不在同一個SCC(不能存在,),需要,如果在同一個S CC則該Boolean formula是Unsatisfiable的。
我們可以在多項式時間內決定2-CNF-SAT問題,因此2-CNF-SAT ∈ P.
假如我們把每個SCC視為一個點(同一個SCC塗同樣顏色)稱作,將每個點之間的邊的方向相反,稱作,在中,依照從原本的Sink開始按照拓撲排序填色,相連的兩個SCC中填入相反的顏色,否則填入相同顏色,將同Sink顏色的點設為true即可以找到assignment。
- xian
The subgraph-isomorphism problem takes two undirected graphs G1 and G2, and it asks whether G1 is isomorphic to a subgraph of G2. Show that the subgraph-isomorphism problem is NP-complete.
【證明】
證明
證明
在指數時間下可解,則也可
且我們已知
又因為
- chung
Given an integer m x n matrix A, and an integer m-vector b, the 0-1 integer-programming problem asks whether there exists an integer n-vector x with elements in the set {0, 1} such that Ax ≤ b. Prove that 0-1 integer programming problem is NP-complete. (Hint: Reduce from 3-CNF-SAT.)
【證明】
Problem ∈ NP : Find a certificate to verify that it is the correct answer to this question.
Problem ∈ NP-hard : 3-CNF-SAT 0-1 integer- programming problem
- yee
Based on hw14-7,we know that longest-simple-cycle problem is an NP-problem.
Prove that the problem is NP-complete
【解題思路】
由14-7我們知道LSC為NP問題,依序為,且已知Hami-cycle 為NP-complete問題,因此可由Hami-cycle reduce to LSC 來證明LSC也是NP-complete問題。
【證明】
若一Graph存在一個Hami-cycle也代表該Graph存在一k = |V|的LSC,若一Graph存在一序列的LSC,也代表該Graph也存在一Hami-cycle,因此可知Hami-cycle\ \ iff.\ LSC