Skip to content

Commit 81bbadf

Browse files
committed
switch to nauty for generating posets
1 parent b0f09d9 commit 81bbadf

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/sage/combinat/posets/posets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8884,11 +8884,11 @@ class FinitePosets_n(UniqueRepresentation, Parent):
88848884
sage: P.cardinality()
88858885
5
88868886
sage: for p in P: print(p.cover_relations())
8887-
[]
8888-
[[1, 2]]
8887+
[[1, 2], [0, 2]]
88898888
[[0, 1], [0, 2]]
8889+
[[0, 2]]
88908890
[[0, 1], [1, 2]]
8891-
[[1, 2], [0, 2]]
8891+
[]
88928892
"""
88938893

88948894
def __init__(self, n) -> None:
@@ -8945,8 +8945,8 @@ def __iter__(self):
89458945
sage: list(P)
89468946
[Finite poset containing 2 elements, Finite poset containing 2 elements]
89478947
"""
8948-
from sage.graphs.digraph_generators import DiGraphGenerators
8949-
for dig in DiGraphGenerators()(self._n, is_poset):
8948+
from sage.graphs.digraph_generators import DiGraphGenerators as DG
8949+
for dig in DG().nauty_posetg(f"{self._n} o"):
89508950
# We need to relabel the digraph since range(self._n) must be a linear
89518951
# extension. Too bad we need to compute this again. TODO: Fix this.
89528952
label_dict = dict(zip(dig.topological_sort(), range(dig.order())))

src/sage/combinat/tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,15 @@
844844
845845
Partial orders on a set of `8` elements, up to isomorphism::
846846
847-
sage: C = Posets(8); C
848-
Posets containing 8 elements
847+
sage: C = Posets(7); C
848+
Posets containing 7 elements
849849
sage: C.cardinality()
850-
16999
850+
2045
851851
852852
::
853853
854854
sage: C.unrank(20).plot()
855-
Graphics object consisting of 20 graphics primitives
855+
Graphics object consisting of ... graphics primitives
856856
857857
.. image:: ../../media/a_poset.png
858858

src/sage/databases/findstat.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,16 +4002,17 @@ def _finite_lattices(n):
40024002
TESTS::
40034003
40044004
sage: from sage.databases.findstat import _finite_lattices
4005-
sage: [L.cover_relations() for L in _finite_lattices(4)]
4006-
[[['bottom', 0], ['bottom', 1], [0, 'top'], [1, 'top']],
4007-
[['bottom', 0], [0, 1], [1, 'top']]]
4005+
sage: sorted((L.cover_relations() for L in _finite_lattices(4)),
4006+
....: key=len)
4007+
[[['bottom', 0], [0, 1], [1, 'top']],
4008+
[['bottom', 0], ['bottom', 1], [0, 'top'], [1, 'top']]]
40084009
"""
40094010
if n <= 2:
40104011
for P in Posets(n):
40114012
if P.is_lattice():
40124013
yield LatticePoset(P)
40134014
else:
4014-
for P in Posets(n-2):
4015+
for P in Posets(n - 2):
40154016
Q = P.with_bounds()
40164017
if Q.is_lattice():
40174018
yield LatticePoset(Q)

0 commit comments

Comments
 (0)