Spanning Trees

Spanning Tree

A spanning tree for a weighted graph is a tree in which each vertex is connected and . It is any sub-graph of that connects all nodes without any cycles.

Link to original

Minimum Spanning Tree

For all spanning trees, there must be one where the sum of all weights is minimal, this is called a minimum spanning tree (MST). In this example, .

Link to original

Kruskal’s Spanning Tree Algorithm

Kruskal's Spanning Tree Algorithm

:

  1. Sort the edge list by weight (shortest first)
  2. Initialise a set
  3. While sorted list is not empty:
    1. Dequeue the shortest edge from
    2. If is acyclic:
      1. Update
  4. Return tree
Link to original

Theorem: Termination time for Kruskal’s is .

  1. For step 1, we need to sort which can be done using merge-sort or some equivalently efficient sorting algorithm. Time to sort by weight .
  2. Steps 3.1 and 3.2.1 are primitive and take steps for each iteration . The total time for these is
  3. Step 3.2 requires checking whether and are already connected since a second connection would create a cycle. Here, we use an algorithm called quick-union find. Total time to check , where is a very slow growing function. (see Cormen et al. 21.3)
  4. Hence the total worst-case termination time is:
## Prim's Spanning Tree Algorithm ![[Prim's Spanning Tree Algorithm]] ### Theorem: Termination time for Prim's is $O(|E| + |V| \log |V|)$. - It is subject to the data structure used for maintaining the priority queue, though we can use a structure called a **Fibonacci Heap** to obtain these complexity bounds. (*see Cormen et al. 19*)