<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Algorithms Q&amp;A - Recent questions and answers in NP-Completeness</title>
<link>https://notexponential.com/qa/np-completeness</link>
<description>Powered by Question2Answer</description>
<item>
<title>Answered: Long chain of friends</title>
<link>https://notexponential.com/556/long-chain-of-friends?show=934#a934</link>
<description>A chain of friends that is of length n is essentially a Hamiltonian Path. &lt;br /&gt;
&lt;br /&gt;
Therefore, the “long chain of friends” problem is a generalization of the Hamiltonian Path problem. &lt;br /&gt;
&lt;br /&gt;
The reduction diagram can be drawn from the Hamiltonian Path to a Long chain of friends problem by instantiating the value of k = n.</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/556/long-chain-of-friends?show=934#a934</guid>
<pubDate>Wed, 13 Dec 2023 05:23:48 +0000</pubDate>
</item>
<item>
<title>Answered: Prove that Sub Graph Isomorphism is Hard</title>
<link>https://notexponential.com/702/prove-that-sub-graph-isomorphism-is-hard?show=932#a932</link>
<description>To prove the decision version of whether a graph has a subgraph we will show a reduction from Clique to this Subgraph problem, I will call this problem SbG.&lt;br /&gt;
&lt;br /&gt;
Hence for a NP-complete reduction we would first have to prove that SbG is in NP. We can verify in polynomial time that H is indeed a subgraph in G, this is trivial as if we have the &amp;lt;K,E`&amp;gt; we can check whether Graph G indeed has those vertices and edge pairs by traversing those specific edges and vertices in G. &lt;br /&gt;
&lt;br /&gt;
Given the &amp;lt;K,E`&amp;gt; in graph H, and &amp;lt;V,E&amp;gt; in graph G. Let us assume H is complete graph with K vertices if and only if G has a Clique sized K. We can see that since H is a complete graph on K vertices a Clique with size K in the overall graph G would be this complete graph with exactly K vertices. Hence SbG is at least as hard as the Clique problem, Clique &amp;lt;_p SbG&lt;br /&gt;
&lt;br /&gt;
*I can not add images otherwise I would draw the box as well</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/702/prove-that-sub-graph-isomorphism-is-hard?show=932#a932</guid>
<pubDate>Wed, 13 Dec 2023 01:27:58 +0000</pubDate>
</item>
<item>
<title>Answered: k-degree constrained spanning tree</title>
<link>https://notexponential.com/387/k-degree-constrained-spanning-tree?show=927#a927</link>
<description>If in a tree, the maximum degree is 2 , then the tree is simply a path. This allows us to observe that the problem of finding spanning tree where no vertex has degree more than 2 is equivalent to finding a Hamiltonian path.&lt;br /&gt;
&lt;br /&gt;
Therefore, the k -degree constrained spanning tree problem is simply a generalization of the Hamiltonian Path problem. Specifically, Hamiltonian Path problem can be directly reduced to the k -degree constrained spanning tree problem by leaving the original graph unchanged and simply using the value of k = 2 .</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/387/k-degree-constrained-spanning-tree?show=927#a927</guid>
<pubDate>Tue, 12 Dec 2023 21:51:45 +0000</pubDate>
</item>
<item>
<title>Answered: Snow White and 7 Conference Rooms</title>
<link>https://notexponential.com/778/snow-white-and-7-conference-rooms?show=780#a780</link>
<description>Set this question as F.&lt;br /&gt;
&lt;br /&gt;
Firstly, there are n people here and we need to divide the n people into 7 rooms. If there is a solution and we need to check whether it qualifies. There is a maximum of n people per room, we just need to check if they know anyone. If we use the adjacency matrix to store the relationships between people, it takes only O(n^2) time complexity to traverse through. Therefore, question F belongs to NP.&lt;br /&gt;
&lt;br /&gt;
Secondly, Coloring question is known as a NP-complete problem.&lt;br /&gt;
&lt;br /&gt;
Thirdly, there is an example show that we can reduce Coloring to F.&lt;br /&gt;
&lt;br /&gt;
F: We set each person as a node and connect them if they know each other. In this situation, the relationships of all people can be stored in a graph.&lt;br /&gt;
&lt;br /&gt;
In question Coloring, any two nodes of the same color cannot be adjacent to each other.&lt;br /&gt;
&lt;br /&gt;
In F, any two people who know each other can be in a same room.&lt;br /&gt;
&lt;br /&gt;
We create a graph like the relationships of F, and we tried to use 7 colors to paint the whole graph. If there is a solution the F can be solved, else it is not possible.&lt;br /&gt;
&lt;br /&gt;
Above all, F reduces to Coloring question in polynomial time.</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/778/snow-white-and-7-conference-rooms?show=780#a780</guid>
<pubDate>Tue, 20 Dec 2022 03:54:07 +0000</pubDate>
</item>
<item>
<title>Answered: What&#039;s the time complexity for solving Sudoku with backtrack method?</title>
<link>https://notexponential.com/450/whats-time-complexity-solving-sudoku-with-backtrack-method?show=671#a671</link>
<description>Can be optimized, the goal is to choose the location that is most prioritized, and choose the number that can retain the maximum success rate.</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/450/whats-time-complexity-solving-sudoku-with-backtrack-method?show=671#a671</guid>
<pubDate>Thu, 02 May 2019 05:52:44 +0000</pubDate>
</item>
<item>
<title>Answered: Prove that 3-Coloring is NP Hard (starting with SAT as known NP hard problem)</title>
<link>https://notexponential.com/489/prove-that-coloring-hard-starting-with-sat-known-hard-problem?show=492#a492</link>
<description>&lt;p&gt;&lt;strong&gt;Step 1: Prove 3-Coloring is in NP&lt;/strong&gt;&lt;br&gt;We need to check&amp;nbsp;whether each edge in graph G(V,E) connects two vertexes with two different colors. If we represent the graph using Adjacency Matrix A[1..n, 1..n] where A[i,j]=1 if (i,j) is an edge. Then we can check all of the edges in &amp;nbsp;O(n), which is absolutely a polynomial time complexity. Thus, 3-Coloring is in NP.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Step 2: Reduce &amp;nbsp;SAT as known NP hard problem to 3-Coloring&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;I. Since there are 3 colors, saying a, b and c. There are only 3 situations for each edge to have different colors, the two vertexes an edge can be (a,b)(a,c)(b,c).&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;II. If we can prove there exists assignments of two vertexes x i,y i for edge i (i:1..n)which make the boolean formula true (x 1 or y 1) and (x 2 or y 2) and...(x n or y n) be true. &amp;nbsp;&amp;nbsp;( &amp;nbsp;according to (2) I, &amp;nbsp;&amp;nbsp;&amp;nbsp;we can know that (a or b) , (a or c), (b or c) &amp;nbsp;are the only three true situations )&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;By now, we reduce 3-Coloring to SAT problem, which is a known NP hard problem. So we can get the conclusion that 3-Coloring is NP-Hard.&lt;/p&gt;</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/489/prove-that-coloring-hard-starting-with-sat-known-hard-problem?show=492#a492</guid>
<pubDate>Sun, 03 Dec 2017 01:51:20 +0000</pubDate>
</item>
<item>
<title>Answered: Cook-Levin Theorem</title>
<link>https://notexponential.com/410/cook-levin-theorem?show=413#a413</link>
<description>The construction of the CNF formula is the essence of the Cook Levin theorem. &amp;nbsp;The theorem itself is quite involved, but in the past people have presented that as their P4 project. &amp;nbsp;You can do a quick google search for that and find it.&lt;br /&gt;
&lt;br /&gt;
The fact that the formula is polynomial in terms of f(n), is the key aspect of that. &amp;nbsp;The theorem shows that the solving a given problem instance using its NTM is equivalent to the formula being satisfiable. &amp;nbsp;Thus, CSAT is NP-hard.</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/410/cook-levin-theorem?show=413#a413</guid>
<pubDate>Tue, 06 Dec 2016 18:03:55 +0000</pubDate>
</item>
<item>
<title>Answered: Prove that Vertex Cover is NP-hard problem</title>
<link>https://notexponential.com/383/prove-that-vertex-cover-is-np-hard-problem?show=385#a385</link>
<description>&lt;p&gt;Because in a graph G, if we are given a vertex cover, we can find the remaining set of vertices to be a set of independent set. Thus we can do the following reduction in polynomial time:&lt;br&gt;&lt;img alt=&quot;&quot; src=&quot;https://c2.staticflickr.com/6/5790/31073240761_6b7e00df88_b.jpg&quot; style=&quot;height:217px; width:382px&quot;&gt;&lt;br&gt;That means, if we want to find the minimum VC, we can do so by finding out the maximum &amp;nbsp;IS.&lt;br&gt;&lt;br&gt;As IS is proven to be NP-hard, VC is NP-hard too.&lt;/p&gt;&lt;p&gt;The full chain starting SAT can be written as:&lt;/p&gt;&lt;p&gt;SAT &amp;lt;=p CLIQUE &amp;lt;=p Independent Set &amp;lt;=p Vertex Cover&lt;/p&gt;</description>
<category>NP-Completeness</category>
<guid isPermaLink="true">https://notexponential.com/383/prove-that-vertex-cover-is-np-hard-problem?show=385#a385</guid>
<pubDate>Wed, 23 Nov 2016 03:10:15 +0000</pubDate>
</item>
</channel>
</rss>