Maximum cardinality search is a graph search that repeatedly selects an unselected graph vertex with the largest number of already selected neighbors. All counts start at zero, and ties may be broken arbitrarily. Each selection increases the count of each of its unselected neighbors by 1 (Tarjan and Yannakakis 1984).
For a finite simple graph, the reverse of the selection order is a perfect
elimination ordering iff the graph
is chordal. Equivalently, in the selection order,
the already selected neighbors of each graph vertex
must form a clique. A test for this condition chooses,
for each graph vertex with an earlier neighbor, its
most recently selected neighbor .
All its other earlier neighbors must be adjacent to
. If these checks pass, induction through the selection
order shows that the earlier neighbors of every graph
vertex form a clique.
Using adjacency lists and grouping unselected vertices by their current counts makes the search linear.
For the test, group the vertices by their chosen
, then mark each such
's set of earlier neighbors once for all tests using it. Together,
the search and ordering test take linear time in the
total numbers of vertices and edges
(Tarjan and Yannakakis 1984). Lexicographic
breadth-first search gives another linear time
test using the order in which the neighbors were selected.