Graph Classes

Chordal Graphs Explained

Chordal graphs are one of the most useful graph classes you may never have heard of. Their defining property is small, but it has a remarkable payoff: problems that are hopeless on general graphs become linear-time easy. Here is what they are, how to spot one, and why they matter.

11 Min Read Updated: July 2026 Intermediate Level
Mohammed Islam Hadjoudj
Mohammed Islam Hadjoudj
Expert Operations Research Engineer

What Is a Chordal Graph?

A chordal graph, also called a triangulated graph, is a graph in which every cycle of four or more vertices has a chord. A chord is an edge that joins two vertices of the cycle that are not next to each other along it. Put another way, a chordal graph contains no induced cycle of length four or more: every long cycle is broken up into triangles by shorter edges.

The definition sounds narrow, but many graphs you already know are chordal: trees, complete graphs, and interval graphs are all chordal. The figure below shows the smallest interesting case, a four-vertex cycle, in both its non-chordal and chordal forms.

Not chordal Chordal A B C D A B C D chord A-C
Left: the 4-cycle A-B-C-D has no chord, so it is not chordal. Right: adding the chord A-C splits it into two triangles, making it chordal.

Chords and Induced Cycles

The word doing the heavy lifting is induced. A cycle is induced when the only edges among its vertices are the cycle edges themselves. The moment a chord appears, the long cycle is no longer induced: it has been triangulated.

So the two definitions are the same statement seen from two angles:

Triangles, being length-3 cycles, are always allowed and never need a chord. This is why chordal graphs feel like they are "built from triangles."

Simplicial Vertices and Elimination Orderings

The real power of chordal graphs comes from a structural theorem. First, two definitions.

The Fulkerson-Gross theorem ties it all together:

A graph is chordal if and only if it has a perfect elimination ordering. Moreover, every chordal graph has at least one simplicial vertex, so you can always start peeling one off.

This is the engine behind every efficient algorithm on chordal graphs. Once you have a PEO, you can process the vertices in that order and solve problems greedily, because at each step the vertex's remaining neighbours form a clique with no surprises.

Recognizing a Chordal Graph

Given a graph, how do you tell if it is chordal? You could hunt for induced cycles, but that is slow. The elegant route uses the PEO characterization and runs in linear time, O(V + E).

  1. Run a lexicographic breadth-first search (Lex-BFS) or a maximum cardinality search. Both produce a vertex ordering by always visiting next the vertex with the most already-visited neighbours.
  2. Reverse that ordering. If the graph is chordal, the reverse is guaranteed to be a perfect elimination ordering.
  3. Verify that the candidate really is a PEO. If it is, the graph is chordal; if the check fails, it is not.

The search relies on breadth-first search, adapted so that ties are broken by lexicographic labels. The verification step is the part worth seeing in code.

Verifying an Ordering in Python

Here is the core check: given a graph as an adjacency set and a candidate ordering, decide whether it is a perfect elimination ordering. For each vertex, its later neighbours must all be adjacent to the earliest of them.

def is_perfect_elimination_order(graph, order):
    pos = {v: i for i, v in enumerate(order)}

    for v in order:
        # Neighbours of v that come later in the ordering.
        later = [u for u in graph[v] if pos[u] > pos[v]]
        if len(later) <= 1:
            continue

        # v is simplicial here iff those later neighbours form a clique.
        # It is enough to check they are all adjacent to the earliest one, w.
        w = min(later, key=lambda u: pos[u])
        for u in later:
            if u != w and u not in graph[w]:
                return False   # w and u follow v but are not adjacent

    return True

If this returns True for the reversed Lex-BFS ordering, the graph is chordal. The same PEO is then reused to solve the hard problems below.

Why Chordal Graphs Matter

Chordal graphs are perfect graphs, a class where the chromatic number always equals the size of the largest clique. That structure collapses several famously hard problems into easy ones. Given a perfect elimination ordering, each of these runs in linear time.

ProblemGeneral graphsChordal graphs
Maximum cliqueNP-hardO(V + E)
Optimal coloringNP-hardO(V + E)
Maximum independent setNP-hardO(V + E)
RecognitionO(V + E)

There is one more gem. A graph is chordal exactly when it has a clique tree, a tree decomposition whose bags are the maximal cliques. That connects chordal graphs to treewidth: the treewidth of any graph equals the smallest possible maximum clique size, minus one, over all its chordal completions. For where this class fits among the wider landscape, see the applications of graph theory and the study roadmap.

Real-World Applications

Build intuition on real graphs

Chords, cycles, and cliques are far easier to feel when you can move the vertices yourself. Explore graph structure in the interactive visualizer.

Open the Algorithm Visualizer

Frequently Asked Questions

What is a chordal graph?

A chordal graph, also called a triangulated graph, is a graph in which every cycle of four or more vertices has a chord, an edge joining two vertices of the cycle that are not adjacent along it. Equivalently, it has no induced cycle of length four or more.

How do you check if a graph is chordal?

Run a lexicographic breadth-first search (Lex-BFS) or maximum cardinality search to produce a vertex ordering, then verify that its reverse is a perfect elimination ordering. The whole check runs in O(V + E) linear time.

What is a perfect elimination ordering?

A perfect elimination ordering is an ordering of the vertices in which every vertex is simplicial at the moment it is removed, meaning its remaining neighbours form a clique. A graph is chordal if and only if it has such an ordering.

Why are chordal graphs important?

Chordal graphs are perfect graphs, and several problems that are NP-hard on general graphs, including maximum clique, optimal coloring, and maximum independent set, can be solved in linear time on chordal graphs using a perfect elimination ordering.

Further Learning Resources

See It, Don't Just Read It

Graph structure is far more intuitive in motion. Build a graph, add a chord, and watch a long cycle break into triangles.

Practice with the Algorithm Visualizer