对偏序集进行排序?
有大量的排序算法,但大多数只适用于全序集,因为它们假设任何两个元素都是可比较的。然而,是否有任何好的算法可以对某些元素无法比较的偏序集进行排序?也就是说,给定从偏序集中提取的一组元素 S,输出排序 x1, x2, ..., xn 使得如果 xi ≤ xj,i ≤ j?
There are a huge number of sorting algorithms out there, but most of them only work on totally-ordered sets because they assume that any two elements are comparable. However, are there any good algorithms out there for sorting posets, where some elements are uncomparable? That is, given a set S of elements drawn from a poset, what is the best way to output an ordering x1, x2, ..., xn such that if xi ≤ xj, i ≤ j?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
arxiv 上有一篇题为 Sorting and Selection in Posets 的论文。 org 讨论了 O((w^2)nlog(n/w)) 阶的排序方法,其中 w 是偏序集的“宽度”。我还没有读过这篇论文,但它似乎涵盖了你正在寻找的内容。
There's a paper titled Sorting and Selection in Posets available on arxiv.org which discusses sorting methods of order O((w^2)nlog(n/w)), where w is the "width" of the poset. I haven't read the paper, but it seems like it covers what you are looking for.
拓扑排序非常适合对部分有序集进行排序。大多数算法都是 O(n^2)。以下是来自维基百科的算法:
有一个有用的视频示例。大多数类 Unix 系统都有 tsort 命令。您可以使用
tsort
解决视频的布朗尼示例,如下所示:Topological sort is well-suited to sorting a partially ordered set. Most algorithms are O(n^2). Here's an algorithm from Wikipedia:
There's a helpful video example. Most Unix-like systems have the
tsort
command. You could solve the video's brownie example withtsort
as follows:我将从选择交换排序开始。这是 O(n^2),我认为你不会做得更好。
I'd start with selection-exchange sort. That's O(n^2) and I don't think you'll do better than that.