NP reference Flashcards
(46 cards)
SAT Definition
Determine if a boolean formula in CNF can be satisfied by assigning true/false values to its variables.
- A CNF formula is an AND of clauses, each an OR of literals.
SAT Input
Boolean formula with n variables and m clauses.
SAT Output
A satisfying assignment for each variable (or NO if none exists).
Verification: Check each clause to ensure at least one literal evaluates to true under the given assignment.
Runtime: O(nm) - must check all m clauses, each with up to n literals.
3SAT Definition
Case of SAT where each clause has at most 3 literals.
3SAT Input
Boolean formula, each clause with at most 3 literals.
3SAT Output
A satisfying assignment for each variable (or NO if none exists).
Verification: Check each clause to ensure at least one literal evaluates to true.
Runtime: O(m) - checking each clause takes constant time (maximum 3 literals per clause).
Clique Definition
Determine if a graph has a clique of size k.
- A subset of vertices where every pair is connected by an edge.
Clique Input
Undirected G = (V, E); integer k.
Clique Output
A set of k vertices forming a clique (or NO if none exists).
Verification: Check that every pair of vertices in the solution set has an edge between them.
Runtime: O(n²) - need to check all pairs of vertices in the solution.
Independent Set Definition
Determine if a graph has an independent set of size k.
- A subset of k vertices with no edge between them.
Independent Set Input
Undirected G = (V, E); integer k.
Independent Set Output
A set of k vertices forming an independent set (or NO if none exists).
Verification: Check that no pair of vertices in the solution set has an edge between them.
Runtime: O(n²) - need to check all pairs of vertices in the solution.
Vertex Cover Definition
Determine if a graph has a vertex cover of size at most k.
- A subset of vertices such that every edge in E has at least one endpoint in the subset.
Vertex Cover Input
Undirected G = (V, E); integer k.
Vertex Cover Output
A set of ≤ k vertices forming a vertex cover (or NO if none exists).
Verification: Check that every edge in the graph has at least one endpoint in the solution set.
Runtime: O(m) - need to check each edge in the graph.
Rudrata Path Definition
Determine if a graph has a path from vertex s to vertex t that visits each vertex exactly once.
Rudrata Path Input
Graph G = (V, E); Two vertices in V: s and t.
Rudrata Path Output
A path from s to t visiting every vertex exactly once (or NO if none exists).
Verification: Check that the path starts at s, ends at t, visits all vertices, and each pair of consecutive vertices in the path has an edge between them.
Runtime: O(n) - need to check each vertex appears exactly once and consecutive vertices are connected.
Rudrata Cycle Definition
Determine if a graph has a cycle that visits each vertex exactly one time.
Rudrata Cycle Input
Graph G = (V, E).
Rudrata Cycle Output
A cycle visiting every vertex exactly once (or NO if none exists).
Verification: Check that the sequence forms a valid cycle (last vertex connects to first), contains all vertices exactly once, and each pair of consecutive vertices has an edge between them.
Runtime: O(n) - need to check each vertex appears exactly once and consecutive vertices are connected.
TSP Definition
Determine if a complete weighted graph has a tour visiting all vertices with total weight at most a bound.
TSP Input
Complete graph G = (V, E); edge weights w(i, j); Bound B.
TSP Output
A tour with total weight ≤ B (or NO if none exists).
Verification: Check that the tour visits all vertices exactly once, returns to the starting vertex, and has total weight ≤ B.
Runtime: O(n) - need to check each vertex appears exactly once and calculate the total weight.