AI Glossary / Graphs and symbolic AI / Intermediate
Chordal
Definition
Chordal describes an undirected graph in which every cycle of four or more vertices has a chord: an edge connecting two vertices that are not consecutive on that cycle. Equivalently, the graph has no induced cycle longer than a triangle. Chordal structure supports useful graph algorithms and appears in probabilistic inference and elimination-based computation.
What it means
A four-sided loop with no diagonal is the simplest nonchordal example. Adding one diagonal gives the loop a chord and divides its interior structure into two triangles. Larger graphs require the condition to hold for every relevant cycle, not merely the most visible one in a drawing.
Chordality is a property of connectivity, not visual geometry. Moving vertices on the page or drawing curved edges does not change it. The word also does not mean that every pair of vertices is connected. Complete graphs are chordal, but many much sparser graphs are chordal too.
How it works
One useful characterization is a perfect elimination ordering: remove vertices in an order such that each vertex's remaining neighbors form a clique, meaning they are all connected to one another. A graph is chordal exactly when an appropriate ordering exists under the standard simple-undirected setting.
Recognition algorithms can find and check an ordering without listing every cycle. NetworkX's documented test uses maximum cardinality search and checks the relevant clique condition. When a graph is not chordal, adding suitable fill edges can create a chordal completion. Finding some completion and finding one with the best possible fill or clique size are different tasks.
Three practical examples
- A probabilistic-inference implementation uses a chordal graph as part of organizing computations over cliques.
- An elimination-based numerical or graphical-model method studies fill edges introduced by a chosen variable order.
- A graph-analysis tool checks whether a model belongs to the chordal class before applying an algorithm that relies on that structure.
Think of it this way
Think of a loop with a shortcut connecting nonneighboring points on the loop. Chordality requires such a shortcut in every loop of at least four vertices. The analogy is limited because the shortcut is a graph edge, not necessarily a shorter physical route, and the condition concerns all relevant cycles rather than a particular layout on a map.
Worked example
Take vertices A, B, C, and D with edges A-B, B-C, C-D, and D-A. The cycle A-B-C-D-A has length four, and neither A-C nor B-D is present. The graph is therefore not chordal.
Add A-C. The four-cycle now has a chord. An elimination order B, D, A, C demonstrates chordality: B's remaining neighbors A and C are connected; after removing B, D's remaining neighbors A and C are also connected; the final two vertices satisfy the condition automatically. Now attach a leaf E only to D. The graph remains chordal, since E creates no cycle and can be eliminated first. This shows that a chordal graph need not be complete: E is not connected to A, B, or C. The example verifies both the cycle definition and a compatible elimination view.
Illustrative case study
At fictional Cedar Inference, engineers inspect a graph used for a small probabilistic model. It contains a chordless cycle, so the selected inference construction adds fill edges according to an elimination order. The team records those edges as computational additions rather than claiming they are newly discovered causal relationships.
It compares the resulting clique sizes because they affect computation. This fictional case illustrates why graph structure matters to inference and why a transformation's mathematical purpose must be explained. It does not claim that chordal completion makes every large inference problem inexpensive.
Common misconceptions and mistakes
A graph containing triangles is not necessarily chordal; it may also contain a separate induced cycle of length four or more. Likewise, checking only four-cycles is insufficient because a longer chordless cycle can violate the condition.
Chordal does not mean complete, planar, acyclic, or strongly connected. Trees are chordal because they have no cycles to violate the condition, but many chordal graphs contain cycles. Adding a chord to one cycle may not fix every violation elsewhere. Finally, fill edges introduced for computation should not automatically be interpreted as observed relationships or causal mechanisms.
Business use
For businesses, chordality usually matters behind the scenes in graph-based analytical software. The practical impact may appear as changes in inference cost, memory, or the algorithms available for a model. Technical teams should state whether they tested the original graph or a completed graph and which assumptions the chosen algorithm requires. Users need the computational implication, not an unsupported claim that a chordal model is inherently more accurate.
People also ask
Are trees chordal?
Yes. With no cycles, they cannot contain a chordless cycle of length four or more.
Is every chordal graph complete?
No. The worked graph with a leaf is chordal but has many missing edges.
Does the standard NetworkX test accept directed graphs?
Its documented is_chordal routine does not support directed graphs or multigraphs; the stated property here is undirected.
Check your understanding
A five-vertex cycle has no additional edges. Is it chordal because it contains no four-cycle?
Answer: No. Its length-five cycle has no chord, so it violates the definition directly.
Related terms
- chord
- clique
- induced cycle
- perfect elimination ordering
- chordal completion
- fill edge
- junction tree
Learn next
Add a second loop to the worked graph and test whether the existing diagonal resolves it. Then try an elimination order and inspect remaining-neighbor cliques. This helps distinguish a local drawing-based intuition from a property that must hold across the entire graph.
More in Graphs and symbolic AI
- Chance nodes - Chance nodes represent uncertain outcomes in a decision tree, game tree, or decision network.
- Characters - Characters are the written-text elements that a system represents and processes, such as letters, digits, punctuation, and other symbols.
- Child node - A child node is a node directly below another node, its parent, in a rooted tree.
- Choreography - Choreography is a description or coordination pattern for how multiple participants interact through messages and agreed behavior.
- Chronological backtracking - Chronological backtracking is a search method that responds to a dead end by undoing the most recent decision that still has an untried alternative.
- Circuit verification - Circuit verification checks whether a circuit design satisfies a stated specification.
Sources
Sources: NetworkX, official is_chordal documentation: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.chordal.is_chordal.html . Original research on chordal completion: https://arxiv.org/abs/1612.01966 . Tarjan and Yannakakis, original chordality-recognition research cited in the NetworkX documentation, SIAM Journal on Computing 13 (1984), 566–579.
Previous: Chomsky normal form Next: Choreography