L10 - Kruskal and Proof Flashcards

1
Q

When should Kruskal we used instead of Prims?

A

When the complexity of Prims is known to be too high.

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

What is the problem, input, output, input-output relation of Kruskal?

A

Problem -

Input - Weighted graph.

Output - Tree

I-O Relation - The smallest MST found.

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

What are the 3 steps of the Kruskal algorithm?

A

1 - Sort all edges from lowest to highest weight.

2 - Instantiate an edge set

3 - Add edges to the edge set from lowest to highest weight, ensuring no cycles occur in the tree.

4 - Repeat until MST is created ( no more edges can be added ).

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

What is the overall time complexity of Kruskal?

A

O( E log V )

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

Give proof of the time complexity of Kruskals…

A

Sorting edges = O ( E log E )
While loop over edge set = O ( E )
Within while loop, group edges = O ( log V )

Total = O(E log E ) + O(E) * O(log V)
= O(E log E) + O(E log V)
= O(E log V) since there are always more vertices than edges.

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

Define and explain Lemma…

A

Lemma is the property that given any subset X of a tree T, the shortest edges e from T connecting to each vertex v in X must be in the MST.

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

What does the correctness of both Kruskals and Prims rely on?

A

The Lemma of each tree.

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

Give the proof of correctness for Kruskal…

A

During Kruskal, we have subgraphs K or the graph G. Each K is a cycle free group of shortest edges.

By the Lemma, we can connect each group to one another, ensuring they are connected by the shortest edge possible.

This results in the MST, and proves that Kruskal’s in totally correct.

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

Give the proof of correctness of Prims…

A

At any point in Prims, we are adding the vertex with the lowest edge to the MST being constructed.

By the Lemma, any vertex added to the tree is known to have the lowest cost edge.

Prims terminates when all vertices have been visited. Thus, we know that the MST is correct.

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

What are some caveats of Prims proof of correctness?

A
  • Relies on the assumption that no 2 edges have the same weight within the graph. If this is not the case, the MST is not unique.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does it mean if a problem is NP-Complete?

A

A problem can’t be broken into sub-problems, and no feasible solution exists.

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

Rather than finding an absolute solution, what is best practice for solving NP-Complete problems…?

A

Use heuristic algorithms to find a ‘good enough’ solution, since the solution space is infeasibly large. For example, nature inspired algorithms such as ACO.

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

How can we use MST to answer TSP?

A

Using round tour technique.

However, each vertex is visited twice.

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

When using round-tour to solve the TSP, what can we guarantee about the ouput?

A

The output circuit is less than 2x the MST of the graph.

This provides a good enough solution.

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

Give 2 uses of MST….

A

Image segmentation

Cluster analysis

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