LN11 Polynomial-time reductions Flashcards

P, NP, NP-completeness, Satisfiability problem

1
Q

What is the Minimum Spanning Tree (MST) problem in graph algorithms?

A

The MST problem seeks a tree that spans all nodes in a graph with the minimum total edge cost, useful in network design for minimizing connection costs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the MST lemma related to partitions of a graph’s node set.

A

For any partition of nodes into two sets, the cheapest edge between the sets must be part of the MST, as replacing a more expensive edge would reduce the total cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe Prim’s algorithm for MST.

A

Prim’s algorithm starts from a node and repeatedly adds the cheapest edge that extends the current tree without forming a cycle, until the tree spans all nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe Kruskal’s algorithm for MST.

A

Kruskal’s algorithm starts with an empty edge set and adds the cheapest edge that does not form a cycle, effectively merging disjoint components until a single spanning tree is formed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can Prim’s algorithm be optimized for different types of graphs?

A

Using adjacency lists results in O(n²) time for dense graphs, while a priority queue can reduce this to O(m log n) for sparse graphs by efficiently selecting and updating the smallest edge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the problem of detecting directed cycles in graphs?

A

It involves finding a sequence of nodes that form a directed cycle, or verifying if the graph is a Directed Acyclic Graph (DAG).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why are directed cycles undesirable in task scheduling graphs?

A

Directed cycles indicate a loop in task dependencies, implying circular prerequisites that make it impossible to complete tasks without violating constraints.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a topological order in a directed graph?

A

A topological order is an ordering of nodes where each directed edge (u, v) points from an earlier to a later node in the order, ensuring no cycles exist.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe the basic algorithm for finding a topological order in a DAG.

A

Repeatedly select a node with no incoming edges, place it in the topological order, remove it and its outgoing edges from the graph, and repeat until all nodes are ordered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does DFS help in constructing a topological order?

A

By ignoring non-tree edges and processing nodes in reverse order upon marking them as explored, DFS can create a valid topological order in O(n + m) time for a DAG.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Longest Paths problem, and why is it important in DAGs?

A

It seeks the longest path from a source node without revisiting nodes. In DAGs, it reveals critical paths in project scheduling, representing maximum completion time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a priority queue’s role in optimizing Prim’s algorithm?

A

The priority queue allows efficient selection of the smallest edge connecting the current tree to an outside node, essential for achieving O(m log n) performance in sparse graphs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain the significance of back edges in cycle detection with DFS.

A

In a directed DFS traversal, a back edge indicates a path from a node to one of its ancestors, forming a directed cycle and confirming the graph is not a DAG.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can an MST algorithm handle equal edge weights?

A

By adding small unique perturbations to edges with identical weights, algorithms like Prim’s and Kruskal’s can handle ties without affecting the correctness of the MST result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the critical path in a project schedule represented as a DAG?

A

The critical path is the longest path in a DAG where edge weights represent task durations, determining the minimum time required to complete all tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly