CSC165 ยท 2081 ยท 5 marks
Define chromatic number. How does Kruskal's algorithm find Minimum Spanning Tree?
Define chromatic number. How does Kruskal's algorithm find Minimum Spanning Tree? [5]
Quick answer
The chromatic number of a graph G is the minimum number of colors required to color the vertices of G such that no two adjacent vertices (vertices connected by an edge) share the same color.
Chromatic Number and Kruskal's Algorithm
Part 1: Chromatic Number (Definition)
It is denoted by ฯ(G) (chi of G).
Examples:
- A complete graph K_n has chromatic number ฯ(K_n) = n
- A cycle with an even number of vertices has ฯ = 2
- A cycle with an odd number of vertices has ฯ = 3
- A tree (with more than one vertex) has ฯ = 2
Part 2: Kruskal's Algorithm for Minimum Spanning Tree
A Minimum Spanning Tree (MST) of a weighted graph G is a spanning tree whose total edge weight is minimum among all possible spanning trees.
Steps of Kruskal's Algorithm
Step 1: List all the edges of G in non-decreasing order of their weights.
Step 2: Select the edge of minimum weight. This becomes the first edge of the spanning tree T. (If two edges have equal minimum weight, choose arbitrarily.)
Step 3: At each subsequent stage, select the edge of minimum weight from the remaining edges of G, provided it does not form a cycle with the previously selected edges in T. Add this edge to T.
Step 4: Repeat Step 3 until n - 1 edges have been selected (where n is the number of vertices).
The resulting tree T is the Minimum Spanning Tree.
Illustrative Example
Consider a weighted graph with vertices {A, B, C, D} and edges:
| Edge | Weight |
|---|---|
| A-B | 1 |
| B-C | 3 |
| A-C | 4 |
| B-D | 2 |
| C-D | 5 |
Step 1: Sort edges by weight: A-B (1), B-D (2), B-C (3), A-C (4), C-D (5)
Step 2: Select A-B (weight 1). T = {A-B}
Step 3:
- Select B-D (weight 2). No cycle formed. T = {A-B, B-D}
- Select B-C (weight 3). No cycle formed. T = {A-B, B-D, B-C}
- We now have n - 1 = 3 edges. Stop.
MST Total Weight = 1 + 2 + 3 = 6
Key Property
Kruskal's algorithm is a greedy algorithm that always picks the globally minimum weight edge that does not create a cycle, guaranteeing an optimal (minimum weight) spanning tree.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.