Coloring of Chordal Graphs

Last Updated : 23 Jul, 2025

In mathematical graph theory, a chordal graph is one in which all cycles of four or more vertices have an edge called a chord. One of the most central structured representations used for network simplification is chordal or triangulated graphs.

These graphs are subgraphs of complete graphs - and they have many uses in applications such as database theory, perfect phylogeny, or sparse matrix computations.

Important Points to Remember

  • A chordal graph is a subset of the complete graph.
  • A graph containing no chord is called a hole or chordless cycle.
  • A complete graph is a chordal graph itself.

1) Consider the below graph ABCD. An edge CB is drawn from vertex C to vertex B which acts as a chord in this graph. Hence the below graph is said to be a chordal graph.

Chordal Graph
Chordal Graph

2) Consider the below example of the complete graph. A graph consisting of n*(n-1)/2 edges is said to be a complete graph, where n is the number of vertices. In the complete graph, the edges connecting all vertices are already present and act as a chord. Hence, a complete graph is a superset of a chordal graph. 

Complete graph
Complete graph

Minimum-coloring Algorithm

In this article, we will discuss coloring the chordal graphs by using the greedy coloring algorithm.

Greedy Coloring Algorithm:

  1. First, we need to find the perfect elimination ordering (PEO) of the given chordal graph.
  2. Then, traverse the vertices in the reverse order of that PEO that we have already found.
  3. Gives the smallest coloring to each vertex such that the current vertex color is not used in its neighboring vertices.
  4. If the color of the current vertex is already given to its neighbor then increment the color and assign it to the current vertex.
  5. Repeat steps 3 and 4 until all the vertices are colored.

Example: Consider the below chordal graph ABCD. Let the perfect elimination ordering of this graph be [D, C, B, A]. We will traverse the graph PEO in the reverse direction. Hence, [A, B, C, D] is the reverse of PEO.

1. First, we will color the vertex A with 1 as we need to color with the smallest present color.

2. Now for vertex B, we will check whether its neighbors contain color 1 or not. As vertex 'A' contains color 1, therefore we will increment the color by 1 to color vertex B.

3. Similarly, for vertex C, its neighbor A contains color 1, and B contains color 2 so we will color vertex C to 3.

4. Now, for vertex D, as its neighbors do not contain the color 1 so we will color 1 to vertex D.

Solved Examples on Coloring of Chordal Graphs

Example 1: Coloring a Simple Chordal Graph

Consider the following chordal graph:

Vertices: A, B, C, D

Edges: AB, AC, AD, BC, BD

Perfect Elimination Ordering (PEO): [D, B, C, A]

Solution:

Traverse in reverse PEO: [A, C, B, D]

Color vertex A with color 1.

Vertex C: neighbor A has color 1, so color C with color 2.

Vertex B: neighbor A has color 1, C has color 2, so color B with color 3.

Vertex D: no neighbors with color 1, so color D with color 1.

Final Coloring: A - 1, C - 2, B - 3, D - 1

Example 2: Coloring a Complete Graph

Consider the following complete graph:

Vertices: A, B, C, D

Edges: AB, AC, AD, BC, BD, CD

Perfect Elimination Ordering (PEO): [D, C, B, A]

Solution:

Traverse in reverse PEO: [A, B, C, D]

Color vertex A with color 1.

Vertex B: neighbor A has color 1, so color B with color 2.

Vertex C: neighbors A and B have colors 1 and 2, so color C with color 3.

Vertex D: neighbors A, B, and C have colors 1, 2, and 3, so color D with color 4.

Final Coloring: A - 1, B - 2, C - 3, D - 4

Practice Problems - Coloring of Chordal Graphs

Problem 1: Vertices: A, B, C, D, E

Edges: AB, AC, AD, BE, CE

Find the perfect elimination ordering (PEO) and color the graph using the greedy coloring algorithm.

Problem 2: Vertices: P, Q, R, S, T

Edges: PQ, PR, PS, QR, RS

Determine the PEO and apply the greedy coloring algorithm.

Problem 3: Vertices: M, N, O, P, Q

Edges: MN, MO, MP, NQ, OQ

Identify the PEO and color the graph using the greedy coloring algorithm.

Problem 4: Vertices: X, Y, Z, W

Edges: XY, XZ, YZ, YW

Find the PEO and color the graph using the greedy coloring algorithm.

Problem 5: Vertices: A, B, C, D, E, F

Edges: AB, AC, BD, BE, CF, DF

Determine the PEO and use the greedy coloring algorithm to color the graph.

Problem 6: Vertices: L, M, N, O, P, Q

Edges: LM, LN, MO, NP, OQ, PQ

Identify the PEO and apply the greedy coloring algorithm.

Problem 7: Vertices: U, V, W, X, Y, Z

Edges: UV, UW, VX, WX, XY, YZ

Find the PEO and color the graph using the greedy coloring algorithm.

Problem 8: Vertices: G, H, I, J, K

Edges: GH, GI, HJ, IJ, JK

Determine the PEO and apply the greedy coloring algorithm.

Problem 9: Vertices: A, B, C, D, E, F, G

Edges: AB, AC, AD, AE, AF, BC, BD, BE, BF, CD, CE, CF, DE, DF, EF

Find the PEO and use the greedy coloring algorithm to color the graph.

Problem 10: Vertices: P, Q, R, S, T, U

Edges: PQ, PR, PS, PT, QU, RU, SU, TU

Find the PEO and color the graph using the greedy coloring algorithm.

Comment