PQ-trees and PC-trees are data structures that represent sets of linear and circular orders, respectively, subject to constraints that specific subsets of elements have to be consecutive. While equivalent to each other, PC-trees are conceptually much simpler than PQ-trees; updating a PC-trees so that a set of elements becomes consecutive requires only a single operation, whereas PQ-trees use an update procedure that is described in terms of nine transformation templates that have to be recursively matched and applied. Despite these theoretical advantages, to date no practical PC-tree implementation is available. This might be due to the original description by Hsu and McConnell in some places only sketching the details of the implementation. In this paper, we describe two alternative implementations of PC-trees. For the first one, we follow the approach by Hsu and McConnell, filling in the necessary details and also proposing improvements on the original algorithm. For the second one, we use a different technique for efficiently representing the tree using a Union-Find data structure. In an extensive experimental evaluation we compare our implementations to a variety of other implementations of PQ-trees that are available on the web as part of academic and other software libraries. Our results show that both PC-tree implementations beat their closest fully correct competitor, the PQ-tree implementation from the OGDF library, by a factor of 2 to 4, showing that PC-trees are not only conceptually simpler but also fast in practice. Moreover, we find the Union-Find-based implementation, while having a slightly worse asymptotic runtime, to be twice as fast as the one based on the description by Hsu and McConnell.
翻译:PQ树和PC树是分别代表一系列线性命令和循环命令的数据结构,但受特定元素子集必须连续排列的限制。PC树在概念上比PQ树简单得多;更新PC树在概念上比PQ树简单得多;更新PC树,使一组元素连续运行只需要一次操作,而PQ树则使用9个转换模板描述的更新程序,这些模板必须循环匹配和应用。尽管有这些理论优势,但迄今为止还没有实际的PC树实施。这可能是由于Hsu和McConnell在某些地方最初描述的更差的概念性子组不同。这也许是由于Hsu和McConnell树在概念性方面不同,虽然在概念性方面,在概念性方面,我们描述PC树在概念上的两种备选执行方式。我们遵循了Hsu和McConnell的方法,在必要的细节方面,并提出了对原始算法的改进。第二,我们使用一种不同的方法,用一个基于联盟的数据结构来有效代表树。在广泛的实验评估中,我们没有将我们的执行情况比其他更简单的执行方式,但将PQ-Connell图书馆的另一种执行方法比得更精确地显示我们的执行结果,同时以快速地显示我们的PQ-O-mareal-rreal的进度,同时显示我们的执行结果,以快速执行结果,以快速的进度显示我们的执行。