PQ tree
A PQ tree is a tree-based data structure that represents a family of permutations on a set of elements, discovered and named by Kellogg S.[src] Booth and George S.[src] Lueker in 1976.[src] It is a rooted, labeled tree, in which each element is represented by one of the leaf nodes, and each non-leaf node is labelled P or Q.[src] A P node has at least two children, and a Q node has at least three children.[src] A PQ tree represents its permutations via permissible reorderings of the children of its nodes.[src] The children of a P node may be reordered in any way.[src] The children of a Q node may be put in reverse order, but may not otherwise be reordered.[src] A PQ tree represents all leaf node orderings that can be achieved by any sequence of these two operations.[src] A PQ tree with many P and Q nodes can represent complicated subsets of the set of all possible orderings.[src] However, not every set of orderings may be representable in this way; for instance, if an ordering is represented by a PQ tree, the reverse of the ordering must also be represented by the same tree.[src] PQ trees are used to solve problems where the goal is to find an ordering that satisfies various constraints.[src] In these problems, constraints on the ordering are included one at a time, by modifying the PQ tree structure in such a way that it represents only orderings satisfying the constraint.…[src]
A PQ tree is a tree-based data structure that represents a family of permutations on a set of elements, discovered and named by Kellogg S.[src] Booth and George S.[src] Lueker in 1976.[src] It is a rooted, labeled tree, in which each element is represented by one of the leaf nodes, and each non-leaf node is labelled P or Q.[src] A P node has at least two children, and a Q node has at least three children.[src] A PQ tree represents its permutations via permissible reorderings of the children of its nodes.[src] The children of a P node may be reordered in any way.[src] The children of a Q node may be put in reverse order, but may not otherwise be reordered.[src] A PQ tree represents all leaf node orderings that can be achieved by any sequence of these two operations.[src] A PQ tree with many P and Q nodes can represent complicated subsets of the set of all possible orderings.[src] However, not every set of orderings may be representable in this way; for instance, if an ordering is represented by a PQ tree, the reverse of the ordering must also be represented by the same tree.[src] PQ trees are used to solve problems where the goal is to find an ordering that satisfies various constraints.[src] In these problems, constraints on the ordering are included one at a time, by modifying the PQ tree structure in such a way that it represents only orderings satisfying the constraint.[src] Applications of PQ trees include creating a contig map from DNA fragments, testing a matrix for the consecutive ones property, recognizing interval graphs, and determining whether a graph is planar.[src] ==Examples and notation== [[Image:pq-tree-5-leaves.svg|left|thumb|The PQ tree representing [1 (2 3 4) 5] ]] If all the leaves of a PQ tree are connected directly to a root P node then all possible orderings are allowed.[src] If all the leaves are connected directly to a root Q node then only one order and its reverse are allowed.[src] If nodes a,b,c connect to a Q node, which connects to a root P node, with all other leaf nodes connected directly to the root, then any ordering where a,b,c are contiguous is allowed.[src] Where graphical presentation is unavailable PQ trees are often noted using nested parenthesized lists.[src] Each matched pair of square parentheses represents a Q node and each matched pair of rounded parentheses represent a P node.[src] Leaves are non-parentheses elements of the lists.[src] The image on the left is represented in this notation by [1 (2 3 4) 5].[src] This PQ tree represents the following twelve permutations on the set {1, 2, 3, 4, 5}: 12345, 12435, 13245, 13425, 14235, 14325, 52341, 52431, 53241, 53421, 54231, 54321.[src] ==PC trees== The PC tree, developed by Wei-Kuan Shih and Wen-Lian Hsu, is a more recent generalization of the PQ tree.[src] Like the PQ tree, it represents permutations by reorderings of nodes in a tree, with elements represented at the leaves of the tree.[src] Unlike the PQ tree, the PC tree is unrooted.[src] The nodes adjacent to any non-leaf node labeled P may be reordered arbitrarily as in the PQ tree, while the nodes adjacent to any non-leaf node labeled C have a fixed cyclic order and may only be reordered by reversing this order.[src] Thus, a PC tree can only represent sets of orderings in which any circular permutation or reversal of an ordering in the set is also in the set.[src] However, a PQ tree on n elements may be simulated by a PC tree on n + 1 elements, where the extra element serves to root the PC tree.[src] The data structure operations required to perform a planarity testing algorithm on PC trees are somewhat simpler than the corresponding operations on PQ trees.[src] ==See also== Series-parallel partial order ==References== ==External links== PQ Tree Algorithm and Consecutive Ones Problem Javascript demo of PQ Trees[src]
43 sentences · 43 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"PQ tree." encyclopegia.org, 2026, https://encyclopegia.org/wiki/pq-tree. Accessed 04 December 2026.
Chicago
"PQ tree." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/pq-tree.
APA
encyclopegia.org. (2026). PQ tree. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/pq-tree
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON