A PQ-tree is an ordered rooted tree whose tree leaves represent distinct elements of a set. Each internal
node has type
or
. At a
-node its children can be arbitrarily permuted, while at a
-node their order can only be left as
given or reversed. The represented orders are the left-to-right tree
leaf orders obtainable by these operations (Booth and Lueker 1976).
For example, a -node
with two children, one a
-node
with leaves
,
, and
in that order and the other the leaf
,
permits exactly four orders. The block
or
can occur on either side of
. This tree represents the two
requirements that
and
be adjacent and that
and
be adjacent.
Starting with a single -node
above all leaves represents every permutation of
the ground set with at least two elements. To require that
a subset be consecutive, Booth and Lueker's reduction
replaces the tree by a PQ-tree representing exactly the remaining orders, or reports
that none exists. Successive reductions test the consecutive
ones property. The same method underlies linear time
algorithms for recognizing interval graphs and
testing whether a graph is planar
(Booth and Lueker 1976).