# Perfectly orderable graph

In graph theory, a perfectly orderable graph is a graph whose vertices can be ordered in such a way that a greedy coloring algorithm with that ordering optimally colors every induced subgraph of the given graph. Perfectly orderable graphs form a special case of the perfect graphs, and they include the chordal graphs, comparability graphs, and distance-hereditary graphs. However, testing whether a graph is perfectly orderable is NP-complete.

## Definition

The greedy coloring algorithm, when applied to a given ordering of the vertices of a graph G, considers the vertices of the graph in sequence and assigns each vertex its first available color, the minimum excluded value for the set of colors used by its neighbors. Different vertex orderings may lead this algorithm to use different numbers of colors. There is always an ordering that leads to an optimal coloring – this is true, for instance, of the ordering determined from an optimal coloring by sorting the vertices by their color – but it may be difficult to find. The perfectly orderable graphs are defined to be the graphs for which there is an ordering that is optimal for the greedy algorithm not just for the graph itself, but for all of its induced subgraphs.
More formally, a graph G is said to be perfectly orderable if there exists an ordering π of the vertices of G, such that every induced subgraph of G is optimally colored by the greedy algorithm using the subsequence of π induced by the vertices of the subgraph. An ordering π has this property exactly when there do not exist four vertices a, b, c, and d for which abcd is an induced path, a appears before b in the ordering, and c appears after d in the ordering.

## Computational complexity

Perfectly orderable graphs are NP-complete to recognize. However, it is easy to test whether a particular ordering is a perfect ordering of a graph. Consequently, it is also NP-hard to find a perfect ordering of a graph, even if the graph is already known to be perfectly orderable.

## Related graph classes

Every perfectly orderable graph is a perfect graph.
Chordal graphs are perfectly orderable; a perfect ordering of a chordal graph may be found by reversing a perfect elimination ordering for the graph. Thus, applying greedy coloring to a perfect ordering provides an efficient algorithm for optimally coloring chordal graphs. Comparability graphs are also perfectly orderable, with a perfect ordering being given by a topological ordering of a transitive orientation of the graph. The complement graphs of tolerance graphs are perfectly orderable.
Another class of perfectly orderable graphs is given by the graphs G such that, in every subset of five vertices from G, at least one of the five has a closed neighborhood that is a subset of (or equal to) the closed neighborhood of another of the five vertices. Equivalently, these are the graphs in which the partial order of closed neighborhoods, ordered by set inclusion, has width at most four. The 5-vertex cycle graph has a neighborhood partial order of width five, so four is the maximum width that ensures perfect orderability. As with the chordal graphs (and unlike the perfectly orderable graphs more generally) the graphs with width four are recognizable in polynomial time.
A concept intermediate between the perfect elimination ordering of a chordal graph and a perfect ordering is a semiperfect elimination ordering: in an elimination ordering, there is no three-vertex induced path in which the middle vertex is the first of the three to be eliminated, and in a semiperfect elimination ordering, there is no four-vertex induced path in which one of the two middle vertices is the first to be eliminated. The reverse of this ordering therefore satisfies the requirements of a perfect ordering, so graphs with semiperfect elimination orderings are perfectly orderable. In particular, the same lexicographic breadth-first search algorithm used to find perfect elimination orders of chordal graphs can be used to find semiperfect elimination orders of distance-hereditary graphs, which are therefore also perfectly orderable.
The graphs for which every vertex ordering is a perfect ordering are the cographs. Because cographs are the graphs with no four-vertex induced path, they cannot violate the path-ordering requirement on a perfect ordering.
Several additional classes of perfectly orderable graphs are known.