passagemath-graphs 10.6.1rc1__cp310-cp310-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_graphs-10.6.1rc1.dist-info/METADATA +292 -0
- passagemath_graphs-10.6.1rc1.dist-info/RECORD +260 -0
- passagemath_graphs-10.6.1rc1.dist-info/WHEEL +5 -0
- passagemath_graphs-10.6.1rc1.dist-info/top_level.txt +2 -0
- passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
- passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
- passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
- sage/all__sagemath_graphs.py +39 -0
- sage/combinat/abstract_tree.py +2723 -0
- sage/combinat/all__sagemath_graphs.py +34 -0
- sage/combinat/binary_tree.py +5306 -0
- sage/combinat/cluster_algebra_quiver/all.py +22 -0
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
- sage/combinat/cluster_algebra_quiver/interact.py +124 -0
- sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
- sage/combinat/cluster_algebra_quiver/mutation_type.py +1555 -0
- sage/combinat/cluster_algebra_quiver/quiver.py +2290 -0
- sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
- sage/combinat/designs/MOLS_handbook_data.py +570 -0
- sage/combinat/designs/all.py +58 -0
- sage/combinat/designs/bibd.py +1655 -0
- sage/combinat/designs/block_design.py +1071 -0
- sage/combinat/designs/covering_array.py +269 -0
- sage/combinat/designs/covering_design.py +530 -0
- sage/combinat/designs/database.py +5615 -0
- sage/combinat/designs/design_catalog.py +122 -0
- sage/combinat/designs/designs_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/designs_pyx.pxd +21 -0
- sage/combinat/designs/designs_pyx.pyx +993 -0
- sage/combinat/designs/difference_family.py +3951 -0
- sage/combinat/designs/difference_matrices.py +279 -0
- sage/combinat/designs/evenly_distributed_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
- sage/combinat/designs/ext_rep.py +1064 -0
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
- sage/combinat/designs/group_divisible_designs.py +361 -0
- sage/combinat/designs/incidence_structures.py +2357 -0
- sage/combinat/designs/latin_squares.py +581 -0
- sage/combinat/designs/orthogonal_arrays.py +2244 -0
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +967 -0
- sage/combinat/designs/resolvable_bibd.py +815 -0
- sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
- sage/combinat/designs/subhypergraph_search.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +530 -0
- sage/combinat/designs/twographs.py +306 -0
- sage/combinat/finite_state_machine.py +14874 -0
- sage/combinat/finite_state_machine_generators.py +2006 -0
- sage/combinat/graph_path.py +448 -0
- sage/combinat/interval_posets.py +3908 -0
- sage/combinat/nu_tamari_lattice.py +269 -0
- sage/combinat/ordered_tree.py +1446 -0
- sage/combinat/posets/all.py +46 -0
- sage/combinat/posets/bubble_shuffle.py +247 -0
- sage/combinat/posets/cartesian_product.py +493 -0
- sage/combinat/posets/d_complete.py +182 -0
- sage/combinat/posets/elements.py +273 -0
- sage/combinat/posets/forest.py +30 -0
- sage/combinat/posets/hasse_cython.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/hasse_cython.pyx +174 -0
- sage/combinat/posets/hasse_diagram.py +3672 -0
- sage/combinat/posets/hochschild_lattice.py +158 -0
- sage/combinat/posets/incidence_algebras.py +794 -0
- sage/combinat/posets/lattices.py +5117 -0
- sage/combinat/posets/linear_extension_iterator.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +292 -0
- sage/combinat/posets/linear_extensions.py +1037 -0
- sage/combinat/posets/mobile.py +275 -0
- sage/combinat/posets/moebius_algebra.py +776 -0
- sage/combinat/posets/poset_examples.py +2178 -0
- sage/combinat/posets/posets.py +9360 -0
- sage/combinat/rooted_tree.py +1070 -0
- sage/combinat/shard_order.py +239 -0
- sage/combinat/tamari_lattices.py +384 -0
- sage/combinat/yang_baxter_graph.py +923 -0
- sage/databases/all__sagemath_graphs.py +1 -0
- sage/databases/knotinfo_db.py +1231 -0
- sage/ext_data/all__sagemath_graphs.py +1 -0
- sage/ext_data/graphs/graph_plot_js.html +330 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/graphs/all.py +42 -0
- sage/graphs/asteroidal_triples.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/asteroidal_triples.pyx +320 -0
- sage/graphs/base/all.py +1 -0
- sage/graphs/base/boost_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/boost_graph.pxd +106 -0
- sage/graphs/base/boost_graph.pyx +3045 -0
- sage/graphs/base/c_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/c_graph.pxd +106 -0
- sage/graphs/base/c_graph.pyx +5096 -0
- sage/graphs/base/dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/dense_graph.pxd +28 -0
- sage/graphs/base/dense_graph.pyx +801 -0
- sage/graphs/base/graph_backends.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/graph_backends.pxd +5 -0
- sage/graphs/base/graph_backends.pyx +797 -0
- sage/graphs/base/overview.py +85 -0
- sage/graphs/base/sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/sparse_graph.pxd +90 -0
- sage/graphs/base/sparse_graph.pyx +1653 -0
- sage/graphs/base/static_dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_dense_graph.pxd +5 -0
- sage/graphs/base/static_dense_graph.pyx +1032 -0
- sage/graphs/base/static_sparse_backend.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_backend.pxd +27 -0
- sage/graphs/base/static_sparse_backend.pyx +1583 -0
- sage/graphs/base/static_sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_graph.pxd +37 -0
- sage/graphs/base/static_sparse_graph.pyx +1375 -0
- sage/graphs/bipartite_graph.py +2732 -0
- sage/graphs/centrality.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/centrality.pyx +1038 -0
- sage/graphs/cographs.py +519 -0
- sage/graphs/comparability.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/comparability.pyx +851 -0
- sage/graphs/connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/connectivity.pxd +157 -0
- sage/graphs/connectivity.pyx +4813 -0
- sage/graphs/convexity_properties.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/convexity_properties.pxd +16 -0
- sage/graphs/convexity_properties.pyx +870 -0
- sage/graphs/digraph.py +4754 -0
- sage/graphs/digraph_generators.py +1993 -0
- sage/graphs/distances_all_pairs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/distances_all_pairs.pxd +12 -0
- sage/graphs/distances_all_pairs.pyx +2938 -0
- sage/graphs/domination.py +1363 -0
- sage/graphs/dot2tex_utils.py +100 -0
- sage/graphs/edge_connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/edge_connectivity.pyx +1215 -0
- sage/graphs/generators/all.py +1 -0
- sage/graphs/generators/basic.py +1769 -0
- sage/graphs/generators/chessboard.py +538 -0
- sage/graphs/generators/classical_geometries.py +1611 -0
- sage/graphs/generators/degree_sequence.py +235 -0
- sage/graphs/generators/distance_regular.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generators/distance_regular.pyx +2846 -0
- sage/graphs/generators/families.py +4759 -0
- sage/graphs/generators/intersection.py +565 -0
- sage/graphs/generators/platonic_solids.py +262 -0
- sage/graphs/generators/random.py +2623 -0
- sage/graphs/generators/smallgraphs.py +5741 -0
- sage/graphs/generators/world_map.py +724 -0
- sage/graphs/generic_graph.py +26867 -0
- sage/graphs/generic_graph_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generic_graph_pyx.pxd +34 -0
- sage/graphs/generic_graph_pyx.pyx +1673 -0
- sage/graphs/genus.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/genus.pyx +622 -0
- sage/graphs/graph.py +9645 -0
- sage/graphs/graph_coloring.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_coloring.pyx +2284 -0
- sage/graphs/graph_database.py +1177 -0
- sage/graphs/graph_decompositions/all.py +1 -0
- sage/graphs/graph_decompositions/bandwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.pyx +616 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
- sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
- sage/graphs/graph_decompositions/graph_products.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/graph_products.pyx +508 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
- sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
- sage/graphs/graph_decompositions/slice_decomposition.pyx +1106 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
- sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
- sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
- sage/graphs/graph_editor.py +82 -0
- sage/graphs/graph_generators.py +3314 -0
- sage/graphs/graph_generators_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_generators_pyx.pyx +95 -0
- sage/graphs/graph_input.py +812 -0
- sage/graphs/graph_latex.py +2064 -0
- sage/graphs/graph_list.py +410 -0
- sage/graphs/graph_plot.py +1756 -0
- sage/graphs/graph_plot_js.py +338 -0
- sage/graphs/hyperbolicity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/hyperbolicity.pyx +1704 -0
- sage/graphs/hypergraph_generators.py +364 -0
- sage/graphs/independent_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/independent_sets.pxd +13 -0
- sage/graphs/independent_sets.pyx +402 -0
- sage/graphs/isgci.py +1033 -0
- sage/graphs/isoperimetric_inequalities.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/isoperimetric_inequalities.pyx +489 -0
- sage/graphs/line_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/line_graph.pyx +743 -0
- sage/graphs/lovasz_theta.py +77 -0
- sage/graphs/matching.py +1633 -0
- sage/graphs/matching_covered_graph.py +3590 -0
- sage/graphs/orientations.py +1489 -0
- sage/graphs/partial_cube.py +459 -0
- sage/graphs/path_enumeration.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/path_enumeration.pyx +2040 -0
- sage/graphs/pq_trees.py +1129 -0
- sage/graphs/print_graphs.py +201 -0
- sage/graphs/schnyder.py +865 -0
- sage/graphs/spanning_tree.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/spanning_tree.pyx +1457 -0
- sage/graphs/strongly_regular_db.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/strongly_regular_db.pyx +3340 -0
- sage/graphs/traversals.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/traversals.pxd +9 -0
- sage/graphs/traversals.pyx +1872 -0
- sage/graphs/trees.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/trees.pxd +15 -0
- sage/graphs/trees.pyx +310 -0
- sage/graphs/tutte_polynomial.py +713 -0
- sage/graphs/views.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/views.pyx +794 -0
- sage/graphs/weakly_chordal.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/weakly_chordal.pyx +604 -0
- sage/groups/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
- sage/knots/all.py +6 -0
- sage/knots/free_knotinfo_monoid.py +507 -0
- sage/knots/gauss_code.py +291 -0
- sage/knots/knot.py +682 -0
- sage/knots/knot_table.py +284 -0
- sage/knots/knotinfo.py +2900 -0
- sage/knots/link.py +4715 -0
- sage/sandpiles/all.py +13 -0
- sage/sandpiles/examples.py +225 -0
- sage/sandpiles/sandpile.py +6365 -0
- sage/topology/all.py +22 -0
- sage/topology/cell_complex.py +1214 -0
- sage/topology/cubical_complex.py +1976 -0
- sage/topology/delta_complex.py +1806 -0
- sage/topology/filtered_simplicial_complex.py +744 -0
- sage/topology/moment_angle_complex.py +823 -0
- sage/topology/simplicial_complex.py +5160 -0
- sage/topology/simplicial_complex_catalog.py +92 -0
- sage/topology/simplicial_complex_examples.py +1680 -0
- sage/topology/simplicial_complex_homset.py +205 -0
- sage/topology/simplicial_complex_morphism.py +836 -0
- sage/topology/simplicial_set.py +4102 -0
- sage/topology/simplicial_set_catalog.py +55 -0
- sage/topology/simplicial_set_constructions.py +2954 -0
- sage/topology/simplicial_set_examples.py +865 -0
- sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,493 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
"""
|
3
|
+
Cartesian products of posets
|
4
|
+
|
5
|
+
AUTHORS:
|
6
|
+
|
7
|
+
- Daniel Krenn (2015)
|
8
|
+
"""
|
9
|
+
# ****************************************************************************
|
10
|
+
# Copyright (C) 2015 Daniel Krenn <dev@danielkrenn.at>
|
11
|
+
#
|
12
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
13
|
+
# as published by the Free Software Foundation; either version 2 of
|
14
|
+
# the License, or (at your option) any later version.
|
15
|
+
# https://www.gnu.org/licenses/
|
16
|
+
# ****************************************************************************
|
17
|
+
|
18
|
+
from sage.sets.cartesian_product import CartesianProduct
|
19
|
+
|
20
|
+
|
21
|
+
class CartesianProductPoset(CartesianProduct):
|
22
|
+
r"""
|
23
|
+
A class implementing Cartesian products of posets (and elements
|
24
|
+
thereof). Compared to :class:`CartesianProduct` you are able to
|
25
|
+
specify an order for comparison of the elements.
|
26
|
+
|
27
|
+
INPUT:
|
28
|
+
|
29
|
+
- ``sets`` -- tuple of parents
|
30
|
+
|
31
|
+
- ``category`` -- a subcategory of ``Sets().CartesianProducts() & Posets()``
|
32
|
+
|
33
|
+
- ``order`` -- string or function specifying an order less or equal;
|
34
|
+
it can be one of the following:
|
35
|
+
|
36
|
+
- ``'native'`` -- elements are ordered by their native ordering,
|
37
|
+
i.e., the order the wrapped elements (tuples) provide
|
38
|
+
|
39
|
+
- ``'lex'`` -- elements are ordered lexicographically
|
40
|
+
|
41
|
+
- ``'product'`` -- an element is less or equal to another
|
42
|
+
element, if less or equal is true for all its components
|
43
|
+
(Cartesian projections)
|
44
|
+
|
45
|
+
- a function which performs the comparison `\leq`; it takes two
|
46
|
+
input arguments and outputs a boolean
|
47
|
+
|
48
|
+
Other keyword arguments (``kwargs``) are passed to the constructor
|
49
|
+
of :class:`CartesianProduct`.
|
50
|
+
|
51
|
+
EXAMPLES::
|
52
|
+
|
53
|
+
sage: P = Poset((srange(3), lambda left, right: left <= right))
|
54
|
+
sage: Cl = cartesian_product((P, P), order='lex')
|
55
|
+
sage: Cl((1, 1)) <= Cl((2, 0))
|
56
|
+
True
|
57
|
+
sage: Cp = cartesian_product((P, P), order='product')
|
58
|
+
sage: Cp((1, 1)) <= Cp((2, 0))
|
59
|
+
False
|
60
|
+
sage: def le_sum(left, right):
|
61
|
+
....: return (sum(left) < sum(right) or
|
62
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
63
|
+
sage: Cs = cartesian_product((P, P), order=le_sum)
|
64
|
+
sage: Cs((1, 1)) <= Cs((2, 0))
|
65
|
+
True
|
66
|
+
|
67
|
+
TESTS::
|
68
|
+
|
69
|
+
sage: Cl.category()
|
70
|
+
Join of Category of finite posets and
|
71
|
+
Category of Cartesian products of finite enumerated sets
|
72
|
+
sage: TestSuite(Cl).run(skip=['_test_construction'])
|
73
|
+
sage: Cp.category()
|
74
|
+
Join of Category of finite posets and
|
75
|
+
Category of Cartesian products of finite enumerated sets
|
76
|
+
sage: TestSuite(Cp).run(skip=['_test_construction'])
|
77
|
+
|
78
|
+
.. SEEALSO::
|
79
|
+
|
80
|
+
:class:`CartesianProduct`
|
81
|
+
"""
|
82
|
+
|
83
|
+
def __init__(self, sets, category, order=None, **kwargs) -> None:
|
84
|
+
r"""
|
85
|
+
See :class:`CartesianProductPoset` for details.
|
86
|
+
|
87
|
+
TESTS::
|
88
|
+
|
89
|
+
sage: P = Poset((srange(3), lambda left, right: left <= right))
|
90
|
+
sage: C = cartesian_product((P, P), order='notexisting')
|
91
|
+
Traceback (most recent call last):
|
92
|
+
...
|
93
|
+
ValueError: no order 'notexisting' known
|
94
|
+
sage: C = cartesian_product((P, P), category=(Groups(),))
|
95
|
+
sage: C.category()
|
96
|
+
Join of Category of groups and Category of posets
|
97
|
+
"""
|
98
|
+
if order is None:
|
99
|
+
self._le_ = self.le_product
|
100
|
+
elif isinstance(order, str):
|
101
|
+
try:
|
102
|
+
self._le_ = getattr(self, 'le_' + order)
|
103
|
+
except AttributeError:
|
104
|
+
raise ValueError(f"no order '{order}' known")
|
105
|
+
else:
|
106
|
+
self._le_ = order
|
107
|
+
|
108
|
+
from sage.categories.category import Category
|
109
|
+
from sage.categories.posets import Posets
|
110
|
+
if not isinstance(category, tuple):
|
111
|
+
category = (category,)
|
112
|
+
category = Category.join(category + (Posets(),))
|
113
|
+
super().__init__(sets, category, **kwargs)
|
114
|
+
|
115
|
+
def le(self, left, right):
|
116
|
+
r"""
|
117
|
+
Test whether ``left`` is less than or equal to ``right``.
|
118
|
+
|
119
|
+
INPUT:
|
120
|
+
|
121
|
+
- ``left`` -- an element
|
122
|
+
|
123
|
+
- ``right`` -- an element
|
124
|
+
|
125
|
+
OUTPUT: boolean
|
126
|
+
|
127
|
+
.. NOTE::
|
128
|
+
|
129
|
+
This method uses the order defined on creation of this
|
130
|
+
Cartesian product. See :class:`CartesianProductPoset`.
|
131
|
+
|
132
|
+
EXAMPLES::
|
133
|
+
|
134
|
+
sage: P = posets.ChainPoset(10)
|
135
|
+
sage: def le_sum(left, right):
|
136
|
+
....: return (sum(left) < sum(right) or
|
137
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
138
|
+
sage: C = cartesian_product((P, P), order=le_sum)
|
139
|
+
sage: C.le(C((1, 6)), C((6, 1)))
|
140
|
+
True
|
141
|
+
sage: C.le(C((6, 1)), C((1, 6)))
|
142
|
+
False
|
143
|
+
sage: C.le(C((1, 6)), C((6, 6)))
|
144
|
+
True
|
145
|
+
sage: C.le(C((6, 6)), C((1, 6)))
|
146
|
+
False
|
147
|
+
"""
|
148
|
+
return self._le_(left, right)
|
149
|
+
|
150
|
+
def le_lex(self, left, right):
|
151
|
+
r"""
|
152
|
+
Test whether ``left`` is lexicographically smaller or equal
|
153
|
+
to ``right``.
|
154
|
+
|
155
|
+
INPUT:
|
156
|
+
|
157
|
+
- ``left`` -- an element
|
158
|
+
|
159
|
+
- ``right`` -- an element
|
160
|
+
|
161
|
+
OUTPUT: boolean
|
162
|
+
|
163
|
+
EXAMPLES::
|
164
|
+
|
165
|
+
sage: P = Poset((srange(2), lambda left, right: left <= right))
|
166
|
+
sage: Q = cartesian_product((P, P), order='lex')
|
167
|
+
sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
|
168
|
+
sage: for a in T:
|
169
|
+
....: for b in T:
|
170
|
+
....: assert Q.le(a, b) == (a <= b)
|
171
|
+
....: print('%s <= %s = %s' % (a, b, a <= b))
|
172
|
+
(0, 0) <= (0, 0) = True
|
173
|
+
(0, 0) <= (1, 1) = True
|
174
|
+
(0, 0) <= (0, 1) = True
|
175
|
+
(0, 0) <= (1, 0) = True
|
176
|
+
(1, 1) <= (0, 0) = False
|
177
|
+
(1, 1) <= (1, 1) = True
|
178
|
+
(1, 1) <= (0, 1) = False
|
179
|
+
(1, 1) <= (1, 0) = False
|
180
|
+
(0, 1) <= (0, 0) = False
|
181
|
+
(0, 1) <= (1, 1) = True
|
182
|
+
(0, 1) <= (0, 1) = True
|
183
|
+
(0, 1) <= (1, 0) = True
|
184
|
+
(1, 0) <= (0, 0) = False
|
185
|
+
(1, 0) <= (1, 1) = True
|
186
|
+
(1, 0) <= (0, 1) = False
|
187
|
+
(1, 0) <= (1, 0) = True
|
188
|
+
|
189
|
+
TESTS:
|
190
|
+
|
191
|
+
Check that :issue:`19999` is resolved::
|
192
|
+
|
193
|
+
sage: P = Poset((srange(2), lambda left, right: left <= right))
|
194
|
+
sage: Q = cartesian_product((P, P), order='product')
|
195
|
+
sage: R = cartesian_product((Q, P), order='lex')
|
196
|
+
sage: R(((1, 0), 0)) <= R(((0, 1), 0))
|
197
|
+
False
|
198
|
+
sage: R(((0, 1), 0)) <= R(((1, 0), 0))
|
199
|
+
False
|
200
|
+
"""
|
201
|
+
for l, r, S in \
|
202
|
+
zip(left.value, right.value, self.cartesian_factors()):
|
203
|
+
if l == r:
|
204
|
+
continue
|
205
|
+
if S.le(l, r):
|
206
|
+
return True
|
207
|
+
if S.le(r, l):
|
208
|
+
return False
|
209
|
+
return False # incomparable components
|
210
|
+
return True # equal
|
211
|
+
|
212
|
+
def le_product(self, left, right):
|
213
|
+
r"""
|
214
|
+
Test whether ``left`` is component-wise smaller or equal
|
215
|
+
to ``right``.
|
216
|
+
|
217
|
+
INPUT:
|
218
|
+
|
219
|
+
- ``left`` -- an element
|
220
|
+
|
221
|
+
- ``right`` -- an element
|
222
|
+
|
223
|
+
OUTPUT: boolean
|
224
|
+
|
225
|
+
The comparison is ``True`` if the result of the
|
226
|
+
comparison in each component is ``True``.
|
227
|
+
|
228
|
+
EXAMPLES::
|
229
|
+
|
230
|
+
sage: P = Poset((srange(2), lambda left, right: left <= right))
|
231
|
+
sage: Q = cartesian_product((P, P), order='product')
|
232
|
+
sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
|
233
|
+
sage: for a in T:
|
234
|
+
....: for b in T:
|
235
|
+
....: assert Q.le(a, b) == (a <= b)
|
236
|
+
....: print('%s <= %s = %s' % (a, b, a <= b))
|
237
|
+
(0, 0) <= (0, 0) = True
|
238
|
+
(0, 0) <= (1, 1) = True
|
239
|
+
(0, 0) <= (0, 1) = True
|
240
|
+
(0, 0) <= (1, 0) = True
|
241
|
+
(1, 1) <= (0, 0) = False
|
242
|
+
(1, 1) <= (1, 1) = True
|
243
|
+
(1, 1) <= (0, 1) = False
|
244
|
+
(1, 1) <= (1, 0) = False
|
245
|
+
(0, 1) <= (0, 0) = False
|
246
|
+
(0, 1) <= (1, 1) = True
|
247
|
+
(0, 1) <= (0, 1) = True
|
248
|
+
(0, 1) <= (1, 0) = False
|
249
|
+
(1, 0) <= (0, 0) = False
|
250
|
+
(1, 0) <= (1, 1) = True
|
251
|
+
(1, 0) <= (0, 1) = False
|
252
|
+
(1, 0) <= (1, 0) = True
|
253
|
+
"""
|
254
|
+
return all(
|
255
|
+
S.le(l, r)
|
256
|
+
for l, r, S in
|
257
|
+
zip(left.value, right.value, self.cartesian_factors()))
|
258
|
+
|
259
|
+
def le_native(self, left, right):
|
260
|
+
r"""
|
261
|
+
Test whether ``left`` is smaller or equal to ``right`` in the order
|
262
|
+
provided by the elements themselves.
|
263
|
+
|
264
|
+
INPUT:
|
265
|
+
|
266
|
+
- ``left`` -- an element
|
267
|
+
|
268
|
+
- ``right`` -- an element
|
269
|
+
|
270
|
+
OUTPUT: boolean
|
271
|
+
|
272
|
+
EXAMPLES::
|
273
|
+
|
274
|
+
sage: P = Poset((srange(2), lambda left, right: left <= right))
|
275
|
+
sage: Q = cartesian_product((P, P), order='native')
|
276
|
+
sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
|
277
|
+
sage: for a in T:
|
278
|
+
....: for b in T:
|
279
|
+
....: assert Q.le(a, b) == (a <= b)
|
280
|
+
....: print('%s <= %s = %s' % (a, b, a <= b))
|
281
|
+
(0, 0) <= (0, 0) = True
|
282
|
+
(0, 0) <= (1, 1) = True
|
283
|
+
(0, 0) <= (0, 1) = True
|
284
|
+
(0, 0) <= (1, 0) = True
|
285
|
+
(1, 1) <= (0, 0) = False
|
286
|
+
(1, 1) <= (1, 1) = True
|
287
|
+
(1, 1) <= (0, 1) = False
|
288
|
+
(1, 1) <= (1, 0) = False
|
289
|
+
(0, 1) <= (0, 0) = False
|
290
|
+
(0, 1) <= (1, 1) = True
|
291
|
+
(0, 1) <= (0, 1) = True
|
292
|
+
(0, 1) <= (1, 0) = True
|
293
|
+
(1, 0) <= (0, 0) = False
|
294
|
+
(1, 0) <= (1, 1) = True
|
295
|
+
(1, 0) <= (0, 1) = False
|
296
|
+
(1, 0) <= (1, 0) = True
|
297
|
+
"""
|
298
|
+
return left.value <= right.value
|
299
|
+
|
300
|
+
class Element(CartesianProduct.Element):
|
301
|
+
|
302
|
+
def _le_(self, other):
|
303
|
+
r"""
|
304
|
+
Return if this element is less or equal to ``other``.
|
305
|
+
|
306
|
+
INPUT:
|
307
|
+
|
308
|
+
- ``other`` -- an element
|
309
|
+
|
310
|
+
OUTPUT: boolean
|
311
|
+
|
312
|
+
.. NOTE::
|
313
|
+
|
314
|
+
This method calls :meth:`CartesianProductPoset.le`. Override
|
315
|
+
it in inherited class to change this.
|
316
|
+
|
317
|
+
It can be assumed that this element and ``other`` have
|
318
|
+
the same parent.
|
319
|
+
|
320
|
+
TESTS::
|
321
|
+
|
322
|
+
sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
|
323
|
+
sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
|
324
|
+
sage: def le_sum(left, right):
|
325
|
+
....: return (sum(left) < sum(right) or
|
326
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
327
|
+
sage: C = cartesian_product((QQ, QQ), order=le_sum)
|
328
|
+
sage: C((1/3, 2)) <= C((2, 1/3)) # indirect doctest
|
329
|
+
True
|
330
|
+
sage: C((1/3, 2)) <= C((2, 2)) # indirect doctest
|
331
|
+
True
|
332
|
+
"""
|
333
|
+
return self.parent().le(self, other)
|
334
|
+
|
335
|
+
def __le__(self, other):
|
336
|
+
r"""
|
337
|
+
Return if this element is less than or equal to ``other``.
|
338
|
+
|
339
|
+
INPUT:
|
340
|
+
|
341
|
+
- ``other`` -- an element
|
342
|
+
|
343
|
+
OUTPUT: boolean
|
344
|
+
|
345
|
+
.. NOTE::
|
346
|
+
|
347
|
+
This method uses the coercion framework to find a
|
348
|
+
suitable common parent.
|
349
|
+
|
350
|
+
This method can be deleted once :issue:`10130` is fixed and
|
351
|
+
provides these methods automatically.
|
352
|
+
|
353
|
+
TESTS::
|
354
|
+
|
355
|
+
sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
|
356
|
+
sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
|
357
|
+
sage: def le_sum(left, right):
|
358
|
+
....: return (sum(left) < sum(right) or
|
359
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
360
|
+
sage: C = cartesian_product((QQ, QQ), order=le_sum)
|
361
|
+
sage: C((1/3, 2)) <= C((2, 1/3))
|
362
|
+
True
|
363
|
+
sage: C((1/3, 2)) <= C((2, 2))
|
364
|
+
True
|
365
|
+
|
366
|
+
The following example tests that the coercion gets involved in
|
367
|
+
comparisons; it can be simplified once :issue:`18182` is merged.
|
368
|
+
::
|
369
|
+
|
370
|
+
sage: class MyCP(CartesianProductPoset):
|
371
|
+
....: def _coerce_map_from_(self, S):
|
372
|
+
....: if isinstance(S, self.__class__):
|
373
|
+
....: S_factors = S.cartesian_factors()
|
374
|
+
....: R_factors = self.cartesian_factors()
|
375
|
+
....: if len(S_factors) == len(R_factors):
|
376
|
+
....: if all(r.has_coerce_map_from(s)
|
377
|
+
....: for r,s in zip(R_factors, S_factors)):
|
378
|
+
....: return True
|
379
|
+
sage: QQ.CartesianProduct = MyCP
|
380
|
+
sage: A = cartesian_product((QQ, ZZ), order=le_sum)
|
381
|
+
sage: B = cartesian_product((QQ, QQ), order=le_sum)
|
382
|
+
sage: A((1/2, 4)) <= B((1/2, 5))
|
383
|
+
True
|
384
|
+
"""
|
385
|
+
from sage.structure.element import have_same_parent
|
386
|
+
if have_same_parent(self, other):
|
387
|
+
return self._le_(other)
|
388
|
+
|
389
|
+
from sage.structure.element import get_coercion_model
|
390
|
+
import operator
|
391
|
+
try:
|
392
|
+
return get_coercion_model().bin_op(self, other, operator.le)
|
393
|
+
except TypeError:
|
394
|
+
return False
|
395
|
+
|
396
|
+
def __ge__(self, other):
|
397
|
+
r"""
|
398
|
+
Return if this element is greater than or equal to ``other``.
|
399
|
+
|
400
|
+
INPUT:
|
401
|
+
|
402
|
+
- ``other`` -- an element
|
403
|
+
|
404
|
+
OUTPUT: boolean
|
405
|
+
|
406
|
+
.. NOTE::
|
407
|
+
|
408
|
+
This method uses the coercion framework to find a
|
409
|
+
suitable common parent.
|
410
|
+
|
411
|
+
This method can be deleted once :issue:`10130` is fixed and
|
412
|
+
provides these methods automatically.
|
413
|
+
|
414
|
+
TESTS::
|
415
|
+
|
416
|
+
sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
|
417
|
+
sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
|
418
|
+
sage: def le_sum(left, right):
|
419
|
+
....: return (sum(left) < sum(right) or
|
420
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
421
|
+
sage: C = cartesian_product((QQ, QQ), order=le_sum)
|
422
|
+
sage: C((1/3, 2)) >= C((2, 1/3))
|
423
|
+
False
|
424
|
+
sage: C((1/3, 2)) >= C((2, 2))
|
425
|
+
False
|
426
|
+
"""
|
427
|
+
return other <= self
|
428
|
+
|
429
|
+
def __lt__(self, other):
|
430
|
+
r"""
|
431
|
+
Return if this element is less than ``other``.
|
432
|
+
|
433
|
+
INPUT:
|
434
|
+
|
435
|
+
- ``other`` -- an element
|
436
|
+
|
437
|
+
OUTPUT: boolean
|
438
|
+
|
439
|
+
.. NOTE::
|
440
|
+
|
441
|
+
This method uses the coercion framework to find a
|
442
|
+
suitable common parent.
|
443
|
+
|
444
|
+
This method can be deleted once :issue:`10130` is fixed and
|
445
|
+
provides these methods automatically.
|
446
|
+
|
447
|
+
TESTS::
|
448
|
+
|
449
|
+
sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
|
450
|
+
sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
|
451
|
+
sage: def le_sum(left, right):
|
452
|
+
....: return (sum(left) < sum(right) or
|
453
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
454
|
+
sage: C = cartesian_product((QQ, QQ), order=le_sum)
|
455
|
+
sage: C((1/3, 2)) < C((2, 1/3))
|
456
|
+
True
|
457
|
+
sage: C((1/3, 2)) < C((2, 2))
|
458
|
+
True
|
459
|
+
"""
|
460
|
+
return not self == other and self <= other
|
461
|
+
|
462
|
+
def __gt__(self, other):
|
463
|
+
r"""
|
464
|
+
Return if this element is greater than ``other``.
|
465
|
+
|
466
|
+
INPUT:
|
467
|
+
|
468
|
+
- ``other`` -- an element
|
469
|
+
|
470
|
+
OUTPUT: boolean
|
471
|
+
|
472
|
+
.. NOTE::
|
473
|
+
|
474
|
+
This method uses the coercion framework to find a
|
475
|
+
suitable common parent.
|
476
|
+
|
477
|
+
This method can be deleted once :issue:`10130` is fixed and
|
478
|
+
provides these methods automatically.
|
479
|
+
|
480
|
+
TESTS::
|
481
|
+
|
482
|
+
sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
|
483
|
+
sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
|
484
|
+
sage: def le_sum(left, right):
|
485
|
+
....: return (sum(left) < sum(right) or
|
486
|
+
....: sum(left) == sum(right) and left[0] <= right[0])
|
487
|
+
sage: C = cartesian_product((QQ, QQ), order=le_sum)
|
488
|
+
sage: C((1/3, 2)) > C((2, 1/3))
|
489
|
+
False
|
490
|
+
sage: C((1/3, 2)) > C((2, 2))
|
491
|
+
False
|
492
|
+
"""
|
493
|
+
return not self == other and other <= self
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
# sage.doctest: needs sage.combinat sage.modules
|
3
|
+
r"""
|
4
|
+
D-complete posets
|
5
|
+
|
6
|
+
AUTHORS:
|
7
|
+
|
8
|
+
- Stefan Grosser (06-2020): initial implementation
|
9
|
+
"""
|
10
|
+
|
11
|
+
# ****************************************************************************
|
12
|
+
# Copyright (C) 2020 Stefan Grosser <stefan.grosser1@gmail.com>
|
13
|
+
#
|
14
|
+
# This program is free software: you can redistribute it and/or modify
|
15
|
+
# it under the terms of the GNU General Public License as published by
|
16
|
+
# the Free Software Foundation, either version 2 of the License, or
|
17
|
+
# (at your option) any later version.
|
18
|
+
# https://www.gnu.org/licenses/
|
19
|
+
# ****************************************************************************
|
20
|
+
|
21
|
+
from sage.misc.lazy_attribute import lazy_attribute
|
22
|
+
from .linear_extensions import LinearExtensionsOfPosetWithHooks
|
23
|
+
from .lattices import FiniteJoinSemilattice
|
24
|
+
from collections import deque
|
25
|
+
from sage.rings.integer_ring import ZZ
|
26
|
+
from sage.misc.misc_c import prod
|
27
|
+
|
28
|
+
|
29
|
+
class DCompletePoset(FiniteJoinSemilattice):
|
30
|
+
r"""
|
31
|
+
A d-complete poset.
|
32
|
+
|
33
|
+
D-complete posets are a class of posets introduced by Proctor
|
34
|
+
in [Proc1999]_. It includes common families such as shapes, shifted
|
35
|
+
shapes, and rooted forests. Proctor showed in [PDynk1999]_ that
|
36
|
+
d-complete posets have decompositions in *irreducible* posets,
|
37
|
+
and showed in [Proc2014]_ that d-complete posets admit a hook-length
|
38
|
+
formula (see :wikipedia:`Hook_length_formula`). A complete proof of
|
39
|
+
the hook-length formula can be found in [KY2019]_.
|
40
|
+
|
41
|
+
EXAMPLES::
|
42
|
+
|
43
|
+
sage: from sage.combinat.posets.poset_examples import Posets
|
44
|
+
sage: P = Posets.DoubleTailedDiamond(2)
|
45
|
+
sage: TestSuite(P).run()
|
46
|
+
"""
|
47
|
+
_lin_ext_type = LinearExtensionsOfPosetWithHooks
|
48
|
+
_desc = "Finite d-complete poset"
|
49
|
+
|
50
|
+
@lazy_attribute
|
51
|
+
def _hooks(self):
|
52
|
+
r"""
|
53
|
+
The hook lengths of the elements of the d-complete poset.
|
54
|
+
|
55
|
+
See [KY2019]_ for the definition of hook lengths for d-complete posets.
|
56
|
+
|
57
|
+
TESTS::
|
58
|
+
|
59
|
+
sage: from sage.combinat.posets.d_complete import DCompletePoset
|
60
|
+
sage: P = DCompletePoset(DiGraph({0: [1, 2], 1: [3], 2: [3], 3: []}))
|
61
|
+
sage: P._hooks
|
62
|
+
{0: 1, 1: 2, 2: 2, 3: 3}
|
63
|
+
sage: from sage.combinat.posets.poset_examples import Posets
|
64
|
+
sage: P = DCompletePoset(Posets.YoungDiagramPoset(Partition([3,2,1]))._hasse_diagram.reverse())
|
65
|
+
sage: P._hooks
|
66
|
+
{0: 5, 1: 3, 2: 1, 3: 3, 4: 1, 5: 1}
|
67
|
+
"""
|
68
|
+
hooks = {}
|
69
|
+
|
70
|
+
min_diamond = {} # Maps max of double-tailed diamond to min of double-tailed diamond
|
71
|
+
max_diamond = {} # Maps min of double-tailed diamond to max of double-tailed diamond
|
72
|
+
|
73
|
+
H = self._hasse_diagram
|
74
|
+
|
75
|
+
diamonds, _ = H.diamonds() # Tuples of four elements that are diamonds
|
76
|
+
|
77
|
+
diamond_index = {} # Map max elmt of double tailed diamond to index of diamond
|
78
|
+
|
79
|
+
# Find all the double-tailed diamonds and map the mins and maxes
|
80
|
+
for index, d in enumerate(diamonds):
|
81
|
+
min_diamond[d[3]] = d[0]
|
82
|
+
max_diamond[d[0]] = d[3]
|
83
|
+
diamond_index[d[3]] = index
|
84
|
+
|
85
|
+
min_elmt = d[0]
|
86
|
+
max_elmt = d[3]
|
87
|
+
|
88
|
+
while True:
|
89
|
+
potential_min = H.neighbors_in(min_elmt)
|
90
|
+
potential_max = H.neighbors_out(max_elmt)
|
91
|
+
|
92
|
+
# Check if any of these make a longer double tailed diamond
|
93
|
+
found_diamond = False
|
94
|
+
for mx in potential_max:
|
95
|
+
if H.in_degree(mx) != 1:
|
96
|
+
continue
|
97
|
+
for mn in potential_min:
|
98
|
+
if len(H.all_paths(mn, mx)) == 2:
|
99
|
+
# Success
|
100
|
+
min_elmt = mn
|
101
|
+
max_elmt = mx
|
102
|
+
min_diamond[mx] = mn
|
103
|
+
max_diamond[mn] = mx
|
104
|
+
diamond_index[mx] = index
|
105
|
+
found_diamond = True
|
106
|
+
break
|
107
|
+
if found_diamond:
|
108
|
+
break
|
109
|
+
if not found_diamond:
|
110
|
+
break
|
111
|
+
# Compute the hooks
|
112
|
+
queue = deque(H.sources())
|
113
|
+
enqueued = set()
|
114
|
+
while queue:
|
115
|
+
elmt = queue.popleft()
|
116
|
+
if elmt not in diamond_index:
|
117
|
+
hooks[elmt] = H.order_ideal_cardinality([elmt])
|
118
|
+
else:
|
119
|
+
diamond = diamonds[diamond_index[elmt]]
|
120
|
+
side1 = diamond[1]
|
121
|
+
side2 = diamond[2]
|
122
|
+
hooks[elmt] = hooks[side1] + hooks[side2] - hooks[min_diamond[elmt]]
|
123
|
+
enqueued.add(elmt)
|
124
|
+
|
125
|
+
for c in H.neighbors_out(elmt):
|
126
|
+
if c not in enqueued:
|
127
|
+
queue.append(c)
|
128
|
+
enqueued.add(c)
|
129
|
+
|
130
|
+
return {self._vertex_to_element(key): ZZ(value)
|
131
|
+
for (key, value) in hooks.items()}
|
132
|
+
|
133
|
+
def get_hook(self, elmt):
|
134
|
+
r"""
|
135
|
+
Return the hook length of the element ``elmt``.
|
136
|
+
|
137
|
+
EXAMPLES::
|
138
|
+
|
139
|
+
sage: from sage.combinat.posets.d_complete import DCompletePoset
|
140
|
+
sage: P = DCompletePoset(DiGraph({0: [1], 1: [2]}))
|
141
|
+
sage: P.get_hook(1)
|
142
|
+
2
|
143
|
+
"""
|
144
|
+
return self._hooks[elmt]
|
145
|
+
|
146
|
+
def get_hooks(self) -> dict:
|
147
|
+
r"""
|
148
|
+
Return all the hook lengths as a dictionary.
|
149
|
+
|
150
|
+
EXAMPLES::
|
151
|
+
|
152
|
+
sage: from sage.combinat.posets.d_complete import DCompletePoset
|
153
|
+
sage: P = DCompletePoset(DiGraph({0: [1, 2], 1: [3], 2: [3], 3: []}))
|
154
|
+
sage: P.get_hooks()
|
155
|
+
{0: 1, 1: 2, 2: 2, 3: 3}
|
156
|
+
sage: from sage.combinat.posets.poset_examples import Posets
|
157
|
+
sage: YDP321 = Posets.YoungDiagramPoset(Partition([3,2,1]))
|
158
|
+
sage: P = DCompletePoset(YDP321._hasse_diagram.reverse())
|
159
|
+
sage: P.get_hooks()
|
160
|
+
{0: 5, 1: 3, 2: 1, 3: 3, 4: 1, 5: 1}
|
161
|
+
"""
|
162
|
+
return dict(self._hooks)
|
163
|
+
|
164
|
+
def hook_product(self):
|
165
|
+
r"""
|
166
|
+
Return the hook product for the poset.
|
167
|
+
|
168
|
+
TESTS::
|
169
|
+
|
170
|
+
sage: from sage.combinat.posets.d_complete import DCompletePoset
|
171
|
+
sage: P = DCompletePoset(DiGraph({0: [1, 2], 1: [3], 2: [3], 3: []}))
|
172
|
+
sage: P.hook_product()
|
173
|
+
12
|
174
|
+
sage: P = DCompletePoset(posets.YoungDiagramPoset(Partition([3,2,1]),
|
175
|
+
....: dual=True))
|
176
|
+
sage: P.hook_product()
|
177
|
+
45
|
178
|
+
"""
|
179
|
+
if not self._hasse_diagram:
|
180
|
+
return ZZ.one()
|
181
|
+
|
182
|
+
return ZZ(prod(self._hooks.values()))
|