Graphs (Minimum Spanning Trees) Flashcards

1
Q

What does Prim’s algorithm do?

A
  1. Picks a vertex at random.
  2. Finds the minimum edge (seen so far) and adds it.
  3. For each vertex in the solution, keep adding by the minimum edge
  4. Touches every node with the least amount of weight
    All nodes connectedd to some node once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does Kruskal’s algorithm do?

A

Sorts the list of edges by increasing weight
Puts each vertex in a disjoint set
Goes through each edge (in sorted order)
If the edge connects to a vertex that is already connected then union it.
Each node gets touched in the system with the least amount of total weights.

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

Must all the nodes connect individually?

A

Each node doesn’t need to be exclusively connected to each node, as long as the nodes are connected in the system. For example, if C is connected to F, and B is connected to C, you don’t have to go out of the way to connect B to F because they are already connected in the system.

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