Skip to content

Commit dd3bc96

Browse files
committed
moving optional into blocks
1 parent d6eb09d commit dd3bc96

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/sage/combinat/posets/posets.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# sage.doctest: needs sage.graphs sage.modules sage.plot sage.rings.finite_rings
2+
# sage.doctest: needs sage.graphs sage.modules
33
r"""
44
Finite posets
55
@@ -434,15 +434,16 @@ def Poset(data=None, element_labels=None, cover_relations=False, linear_extensio
434434
With a function that identifies the cover relations: the set
435435
partitions of `\{1, 2, 3\}` ordered by refinement::
436436
437-
sage: elms = SetPartitions(3) # needs sage.combinat
437+
sage: # optional - sage.combinat
438+
sage: elms = SetPartitions(3)
438439
sage: def fcn(A, B):
439440
....: if len(A) != len(B)+1:
440441
....: return False
441442
....: for a in A:
442443
....: if not any(set(a).issubset(b) for b in B):
443444
....: return False
444445
....: return True
445-
sage: Poset((elms, fcn), cover_relations=True) # needs sage.combinat
446+
sage: Poset((elms, fcn), cover_relations=True)
446447
Finite poset containing 5 elements
447448
448449
3. A dictionary of upper covers::
@@ -1932,12 +1933,14 @@ def plot(self, label_elements=True, element_labels=None,
19321933
19331934
This function can be used without any parameters::
19341935
1936+
sage: # optional - sage.plot
19351937
sage: D12 = posets.DivisorLattice(12)
19361938
sage: D12.plot()
19371939
Graphics object consisting of 14 graphics primitives
19381940
19391941
Just the abstract form of the poset; examples of relabeling::
19401942
1943+
sage: # optional - sage.plot
19411944
sage: D12.plot(label_elements=False)
19421945
Graphics object consisting of 8 graphics primitives
19431946
sage: d = {1: 0, 2: 'a', 3: 'b', 4: 'c', 6: 'd', 12: 1}
@@ -1949,12 +1952,14 @@ def plot(self, label_elements=True, element_labels=None,
19491952
19501953
Some settings for coverings::
19511954
1955+
sage: # optional - sage.plot
19521956
sage: d = {(a, b): b/a for a, b in D12.cover_relations()}
19531957
sage: D12.plot(cover_labels=d, cover_color='gray', cover_style='dotted')
19541958
Graphics object consisting of 21 graphics primitives
19551959
19561960
To emphasize some elements and show some options::
19571961
1962+
sage: # optional - sage.plot
19581963
sage: L = LatticePoset({0: [1, 2, 3, 4], 1: [12], 2: [6, 7],
19591964
....: 3: [5, 9], 4: [5, 6, 10, 11], 5: [13],
19601965
....: 6: [12], 7: [12, 8, 9], 8: [13], 9: [13],
@@ -1973,6 +1978,7 @@ def plot(self, label_elements=True, element_labels=None,
19731978
19741979
We check that ``label_elements`` and ``element_labels`` are honored::
19751980
1981+
sage: # optional - sage.plot
19761982
sage: def get_plot_labels(P):
19771983
....: return sorted(t.string for t in P
19781984
....: if isinstance(t, sage.plot.text.Text))
@@ -1990,6 +1996,7 @@ def plot(self, label_elements=True, element_labels=None,
19901996
19911997
The following checks that :trac:`18936` has been fixed and labels still work::
19921998
1999+
sage: # optional - sage.plot
19932000
sage: P = Poset({0: [1,2], 1:[3]})
19942001
sage: heights = {1 : [0], 2 : [1], 3 : [2,3]}
19952002
sage: P.plot(heights=heights)
@@ -2000,6 +2007,7 @@ def plot(self, label_elements=True, element_labels=None,
20002007
20012008
The following checks that equal labels are allowed (:trac:`15206`)::
20022009
2010+
sage: # optional - sage.plot
20032011
sage: P = Poset({1: [2,3]})
20042012
sage: labs = {i: P.rank(i) for i in range(1, 4)}; labs
20052013
{1: 0, 2: 1, 3: 1}
@@ -2008,6 +2016,7 @@ def plot(self, label_elements=True, element_labels=None,
20082016
20092017
The following checks that non-hashable labels are allowed (:trac:`15206`)::
20102018
2019+
sage: # optional - sage.plot
20112020
sage: P = Poset({1: [2,3]})
20122021
sage: labs = {1: [2, 3], 2: [], 3: []}; labs
20132022
{1: [2, 3], 2: [], 3: []}
@@ -2016,6 +2025,7 @@ def plot(self, label_elements=True, element_labels=None,
20162025
20172026
Plot of the empty poset::
20182027
2028+
sage: # optional - sage.plot
20192029
sage: P = Poset({})
20202030
sage: P.plot()
20212031
Graphics object consisting of 0 graphics primitives
@@ -2103,6 +2113,7 @@ def show(self, label_elements=True, element_labels=None,
21032113
21042114
EXAMPLES::
21052115
2116+
sage: # optional - sage.plot
21062117
sage: D = Poset({ 0:[1,2], 1:[3], 2:[3,4] })
21072118
sage: D.plot(label_elements=False)
21082119
Graphics object consisting of 6 graphics primitives
@@ -2112,9 +2123,9 @@ def show(self, label_elements=True, element_labels=None,
21122123
21132124
One more example with cover labels::
21142125
2126+
sage: # optional - sage.plot
21152127
sage: P = posets.PentagonPoset()
21162128
sage: P.show(cover_labels=lambda a, b: a - b)
2117-
21182129
"""
21192130
# We split the arguments into those meant for plot() and those meant for show()
21202131
#
@@ -6710,12 +6721,14 @@ def order_ideal_plot(self, elements):
67106721
67116722
EXAMPLES::
67126723
6724+
sage: # optional - sage.plot
67136725
sage: P = Poset((divisors(1000), attrcall("divides")))
67146726
sage: P.order_ideal_plot([20, 25])
67156727
Graphics object consisting of 41 graphics primitives
67166728
67176729
TESTS::
67186730
6731+
sage: # optional - sage.plot
67196732
sage: P = Poset() # Test empty poset
67206733
sage: P.order_ideal_plot([])
67216734
Graphics object consisting of 0 graphics primitives

0 commit comments

Comments
 (0)