# Trivially perfect graph

In graph theory, a trivially perfect graph is a graph with the property that in each of its induced subgraphs the size of the maximum independent set equals the number of maximal cliques. Trivially perfect graphs were first studied by (Wolk 1962, 1965) but were named by Golumbic (1978); Golumbic writes that "the name was chosen since it is trivial to show that such a graph is perfect." Trivially perfect graphs are also known as comparability graphs of trees, arborescent comparability graphs, and quasi-threshold graphs.

## Equivalent characterizations

Trivially perfect graphs have several other equivalent characterizations:
* They are the comparability graphs of order-theoretic trees. That is, let T be a partial order such that for each t ∈ T, the set {s ∈ T : s < t} is well-ordered by the relation <, and also T possesses a minimum element r. Then the comparability graph of T is trivially perfect, and every trivially perfect graph can be formed in this way.
* They are the graphs that do not have a P$_4$ path graph or a C$_4$ cycle graph as induced subgraphs.
* They are the graphs in which every connected induced subgraph contains a universal vertex.
* They are the graphs that can be represented as the interval graphs for a set of nested intervals. A set of intervals is nested if, for every two intervals in the set, either the two are disjoint or one contains the other.
* They are the graphs that are both chordal and cographs. This follows from the characterization of chordal graphs as the graphs without induced cycles of length greater than three, and of cographs as the graphs without induced paths on four vertices (P$_4$).
* They are the graphs that are both cographs and interval graphs.
* They are the graphs that can be formed, starting from one-vertex graphs, by two operations: disjoint union of two smaller trivially perfect graphs, and the addition of a new vertex adjacent to all the vertices of a smaller trivially perfect graph. These operations correspond, in the underlying forest, to forming a new forest by the disjoint union of two smaller forests and forming a tree by connecting a new root node to the roots of all the trees in a forest.
* They are the graphs in which, for every edge uv, the neighborhoods of u and v (including u and v themselves) are nested: one neighborhood must be a subset of the other.
* They are the permutation graphs defined from stack-sortable permutations.
* They are the graphs with the property that in each of its induced subgraphs the clique cover number equals the number of maximal cliques.
* They are the graphs with the property that in each of its induced subgraphs the clique number equals the pseudo-Grundy number.
* They are the graphs with the property that in each of its induced subgraphs the chromatic number equals the pseudo-Grundy number.

## Related classes of graphs

It follows from the equivalent characterizations of trivially perfect graphs that every trivially perfect graph is also a cograph, a chordal graph, a Ptolemaic graph, an interval graph, and a perfect graph.
The threshold graphs are exactly the graphs that are both themselves trivially perfect and the complements of trivially perfect graphs (co-trivially perfect graphs).
Windmill graphs are trivially perfect.

## Recognition

Chu (2008) describes a simple linear time algorithm for recognizing trivially perfect graphs, based on lexicographic breadth-first search. Whenever the LexBFS algorithm removes a vertex v from the first set on its queue, the algorithm checks that all remaining neighbors of v belong to the same set; if not, one of the forbidden induced subgraphs can be constructed from v. If this check succeeds for every v, then the graph is trivially perfect. The algorithm can also be modified to test whether a graph is the complement graph of a trivially perfect graph, in linear time.
Determining if a general graph is k edge deletions away from a trivially perfect graph is NP-complete, fixed-parameter tractable and can be solved in O(2.45$^k$(m + n)) time.