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,239 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
r"""
|
3
|
+
Shard intersection order
|
4
|
+
|
5
|
+
This file builds a combinatorial version of the shard intersection
|
6
|
+
order of type A (in the classification of finite Coxeter groups). This
|
7
|
+
is a lattice on the set of permutations, closely related to
|
8
|
+
noncrossing partitions and the weak order.
|
9
|
+
|
10
|
+
For technical reasons, the elements of the posets are not permutations,
|
11
|
+
but can be easily converted from and to permutations::
|
12
|
+
|
13
|
+
sage: from sage.combinat.shard_order import ShardPosetElement
|
14
|
+
sage: p0 = Permutation([1,3,4,2])
|
15
|
+
sage: e0 = ShardPosetElement(p0); e0
|
16
|
+
(1, 3, 4, 2)
|
17
|
+
sage: Permutation(list(e0)) == p0
|
18
|
+
True
|
19
|
+
|
20
|
+
.. SEEALSO::
|
21
|
+
|
22
|
+
A general implementation for all finite Coxeter groups is available as
|
23
|
+
:meth:`~sage.categories.finite_coxeter_groups.FiniteCoxeterGroups.ParentMethods.shard_poset`
|
24
|
+
|
25
|
+
REFERENCES:
|
26
|
+
|
27
|
+
.. [Banc2011] \E. E. Bancroft, *Shard Intersections and Cambrian Congruence
|
28
|
+
Classes in Type A.*, Ph.D. Thesis, North Carolina State University. 2011.
|
29
|
+
|
30
|
+
.. [Pete2013] \T. Kyle Petersen, *On the shard intersection order of
|
31
|
+
a Coxeter group*, SIAM J. Discrete Math. 27 (2013), no. 4, 1880-1912.
|
32
|
+
|
33
|
+
.. [Read2011] \N. Reading, *Noncrossing partitions and the shard intersection
|
34
|
+
order*, J. Algebraic Combin., 33 (2011), 483-530.
|
35
|
+
"""
|
36
|
+
from sage.combinat.posets.posets import Poset
|
37
|
+
from sage.graphs.digraph import DiGraph
|
38
|
+
from sage.combinat.permutation import Permutations
|
39
|
+
|
40
|
+
|
41
|
+
class ShardPosetElement(tuple):
|
42
|
+
r"""
|
43
|
+
An element of the shard poset.
|
44
|
+
|
45
|
+
This is basically a permutation with extra stored arguments:
|
46
|
+
|
47
|
+
- ``p`` -- the permutation itself as a tuple
|
48
|
+
- ``runs`` -- the decreasing runs as a tuple of tuples
|
49
|
+
- ``run_indices`` -- list; ``integer -> index of the run``
|
50
|
+
- ``dpg`` -- the transitive closure of the shard preorder graph
|
51
|
+
- ``spg`` -- the transitive reduction of the shard preorder graph
|
52
|
+
|
53
|
+
These elements can easily be converted from and to permutations::
|
54
|
+
|
55
|
+
sage: from sage.combinat.shard_order import ShardPosetElement
|
56
|
+
sage: p0 = Permutation([1,3,4,2])
|
57
|
+
sage: e0 = ShardPosetElement(p0); e0
|
58
|
+
(1, 3, 4, 2)
|
59
|
+
sage: Permutation(list(e0)) == p0
|
60
|
+
True
|
61
|
+
"""
|
62
|
+
def __new__(cls, p):
|
63
|
+
r"""
|
64
|
+
Initialization of the underlying tuple.
|
65
|
+
|
66
|
+
TESTS::
|
67
|
+
|
68
|
+
sage: from sage.combinat.shard_order import ShardPosetElement
|
69
|
+
sage: ShardPosetElement(Permutation([1,3,4,2]))
|
70
|
+
(1, 3, 4, 2)
|
71
|
+
"""
|
72
|
+
return tuple.__new__(cls, p)
|
73
|
+
|
74
|
+
def __init__(self, p):
|
75
|
+
r"""
|
76
|
+
INPUT:
|
77
|
+
|
78
|
+
- ``p`` -- a permutation
|
79
|
+
|
80
|
+
EXAMPLES::
|
81
|
+
|
82
|
+
sage: from sage.combinat.shard_order import ShardPosetElement
|
83
|
+
sage: p0 = Permutation([1,3,4,2])
|
84
|
+
sage: e0 = ShardPosetElement(p0); e0
|
85
|
+
(1, 3, 4, 2)
|
86
|
+
sage: e0.dpg
|
87
|
+
Transitive closure of : Digraph on 3 vertices
|
88
|
+
sage: e0.spg
|
89
|
+
Digraph on 3 vertices
|
90
|
+
"""
|
91
|
+
self.runs = p.decreasing_runs(as_tuple=True)
|
92
|
+
self.run_indices = [0] * (len(p) + 1)
|
93
|
+
for i, bloc in enumerate(self.runs):
|
94
|
+
for j in bloc:
|
95
|
+
self.run_indices[j] = i
|
96
|
+
G = shard_preorder_graph(self.runs)
|
97
|
+
self.dpg = G.transitive_closure()
|
98
|
+
self.spg = G.transitive_reduction()
|
99
|
+
|
100
|
+
def __le__(self, other):
|
101
|
+
"""
|
102
|
+
Comparison between two elements of the poset.
|
103
|
+
|
104
|
+
This is the core function in the implementation of the
|
105
|
+
shard intersection order.
|
106
|
+
|
107
|
+
One first compares the number of runs, then the set partitions,
|
108
|
+
then the pre-orders.
|
109
|
+
|
110
|
+
EXAMPLES::
|
111
|
+
|
112
|
+
sage: from sage.combinat.shard_order import ShardPosetElement
|
113
|
+
sage: p0 = Permutation([1,3,4,2])
|
114
|
+
sage: p1 = Permutation([1,4,3,2])
|
115
|
+
sage: e0 = ShardPosetElement(p0)
|
116
|
+
sage: e1 = ShardPosetElement(p1)
|
117
|
+
sage: e0 <= e1
|
118
|
+
True
|
119
|
+
sage: e1 <= e0
|
120
|
+
False
|
121
|
+
|
122
|
+
sage: p0 = Permutation([1,2,5,7,3,4,6,8])
|
123
|
+
sage: p1 = Permutation([2,5,7,3,4,8,6,1])
|
124
|
+
sage: e0 = ShardPosetElement(p0)
|
125
|
+
sage: e1 = ShardPosetElement(p1)
|
126
|
+
sage: e0 <= e1
|
127
|
+
True
|
128
|
+
sage: e1 <= e0
|
129
|
+
False
|
130
|
+
"""
|
131
|
+
if not isinstance(other, ShardPosetElement) or len(self) != len(other):
|
132
|
+
raise TypeError("these are not comparable")
|
133
|
+
if self.runs == other.runs:
|
134
|
+
return True
|
135
|
+
|
136
|
+
# r1 must have less runs than r0
|
137
|
+
if len(other.runs) > len(self.runs):
|
138
|
+
return False
|
139
|
+
|
140
|
+
dico1 = other.run_indices
|
141
|
+
|
142
|
+
# conversion: index of run in r0 -> index of run in r1
|
143
|
+
dico0 = [None] * len(self.runs)
|
144
|
+
for i, bloc in enumerate(self.runs):
|
145
|
+
j0 = dico1[bloc[0]]
|
146
|
+
for k in bloc:
|
147
|
+
if dico1[k] != j0:
|
148
|
+
return False
|
149
|
+
dico0[i] = j0
|
150
|
+
|
151
|
+
# at this point, the set partitions given by tuples are comparable
|
152
|
+
dg0 = self.spg
|
153
|
+
dg1 = other.dpg
|
154
|
+
|
155
|
+
for i, j in dg0.edge_iterator(labels=False):
|
156
|
+
if dico0[i] != dico0[j] and not dg1.has_edge(dico0[i], dico0[j]):
|
157
|
+
return False
|
158
|
+
return True
|
159
|
+
|
160
|
+
|
161
|
+
def shard_preorder_graph(runs):
|
162
|
+
"""
|
163
|
+
Return the preorder attached to a tuple of decreasing runs.
|
164
|
+
|
165
|
+
This is a directed graph, whose vertices correspond to the runs.
|
166
|
+
|
167
|
+
There is an edge from a run `R` to a run `S` if `R` is before `S`
|
168
|
+
in the list of runs and the two intervals defined by the initial and
|
169
|
+
final indices of `R` and `S` overlap.
|
170
|
+
|
171
|
+
This only depends on the initial and final indices of the runs.
|
172
|
+
For this reason, this input can also be given in that shorten way.
|
173
|
+
|
174
|
+
INPUT:
|
175
|
+
|
176
|
+
- ``runs`` -- either
|
177
|
+
|
178
|
+
- a tuple of tuples, the runs of a permutation, or
|
179
|
+
|
180
|
+
- a tuple of pairs `(i,j)`, each one standing for a run from `i` to `j`
|
181
|
+
|
182
|
+
OUTPUT: a directed graph, with vertices labelled by integers
|
183
|
+
|
184
|
+
EXAMPLES::
|
185
|
+
|
186
|
+
sage: from sage.combinat.shard_order import shard_preorder_graph
|
187
|
+
sage: s = Permutation([2,8,3,9,6,4,5,1,7])
|
188
|
+
sage: def cut(lr):
|
189
|
+
....: return tuple((r[0], r[-1]) for r in lr)
|
190
|
+
sage: shard_preorder_graph(cut(s.decreasing_runs()))
|
191
|
+
Digraph on 5 vertices
|
192
|
+
sage: s = Permutation([9,4,3,2,8,6,5,1,7])
|
193
|
+
sage: P = shard_preorder_graph(s.decreasing_runs())
|
194
|
+
sage: P.is_isomorphic(digraphs.TransitiveTournament(3))
|
195
|
+
True
|
196
|
+
"""
|
197
|
+
N = len(runs)
|
198
|
+
dg = DiGraph(N)
|
199
|
+
dg.add_edges((i, j) for i in range(N - 1)
|
200
|
+
for j in range(i + 1, N)
|
201
|
+
if runs[i][-1] < runs[j][0] and runs[j][-1] < runs[i][0])
|
202
|
+
return dg
|
203
|
+
|
204
|
+
|
205
|
+
def shard_poset(n):
|
206
|
+
"""
|
207
|
+
Return the shard intersection order on permutations of size `n`.
|
208
|
+
|
209
|
+
This is defined on the set of permutations. To every permutation,
|
210
|
+
one can attach a pre-order, using the descending runs and their
|
211
|
+
relative positions.
|
212
|
+
|
213
|
+
The shard intersection order is given by the implication (or refinement)
|
214
|
+
order on the set of pre-orders defined from all permutations.
|
215
|
+
|
216
|
+
This can also be seen in a geometrical way. Every pre-order defines
|
217
|
+
a cone in a vector space of dimension `n`. The shard poset is given by
|
218
|
+
the inclusion of these cones.
|
219
|
+
|
220
|
+
.. SEEALSO::
|
221
|
+
|
222
|
+
:func:`~sage.combinat.shard_order.shard_preorder_graph`
|
223
|
+
|
224
|
+
EXAMPLES::
|
225
|
+
|
226
|
+
sage: P = posets.ShardPoset(4); P # indirect doctest
|
227
|
+
Finite poset containing 24 elements
|
228
|
+
sage: P.chain_polynomial() # needs sage.libs.flint
|
229
|
+
34*q^4 + 90*q^3 + 79*q^2 + 24*q + 1
|
230
|
+
sage: P.characteristic_polynomial()
|
231
|
+
q^3 - 11*q^2 + 23*q - 13
|
232
|
+
sage: P.zeta_polynomial() # needs sage.libs.flint
|
233
|
+
17/3*q^3 - 6*q^2 + 4/3*q
|
234
|
+
sage: P.is_self_dual()
|
235
|
+
False
|
236
|
+
"""
|
237
|
+
import operator
|
238
|
+
Sn = [ShardPosetElement(s) for s in Permutations(n)]
|
239
|
+
return Poset([Sn, operator.le], cover_relations=False, facade=True)
|
@@ -0,0 +1,384 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
# sage.doctest: needs sage.modules
|
3
|
+
r"""
|
4
|
+
Generalized Tamari lattices
|
5
|
+
|
6
|
+
These lattices depend on three parameters `a`, `b` and `m`, where `a`
|
7
|
+
and `b` are positive integers and `m` is a nonnegative
|
8
|
+
integer.
|
9
|
+
|
10
|
+
The elements are :func:`Dyck paths<sage.combinat.dyck_word.DyckWord>`
|
11
|
+
in the `(a \times b)`-rectangle. The order relation depends on `m`.
|
12
|
+
|
13
|
+
To use the provided functionality, you should import Generalized
|
14
|
+
Tamari lattices by typing::
|
15
|
+
|
16
|
+
sage: from sage.combinat.tamari_lattices import GeneralizedTamariLattice
|
17
|
+
|
18
|
+
Then, ::
|
19
|
+
|
20
|
+
sage: GeneralizedTamariLattice(3,2)
|
21
|
+
Finite lattice containing 2 elements
|
22
|
+
sage: GeneralizedTamariLattice(4,3)
|
23
|
+
Finite lattice containing 5 elements
|
24
|
+
|
25
|
+
The classical **Tamari lattices** are special cases of this construction and
|
26
|
+
are also available directly using the catalogue of posets, as follows::
|
27
|
+
|
28
|
+
sage: posets.TamariLattice(3)
|
29
|
+
Finite lattice containing 5 elements
|
30
|
+
|
31
|
+
.. SEEALSO::
|
32
|
+
|
33
|
+
For more detailed information see :meth:`TamariLattice`,
|
34
|
+
:meth:`GeneralizedTamariLattice`.
|
35
|
+
"""
|
36
|
+
# ****************************************************************************
|
37
|
+
# Copyright (C) 2012-2018 Frédéric Chapoton <chapoton@math.unistra.fr>
|
38
|
+
#
|
39
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
40
|
+
#
|
41
|
+
# This code is distributed in the hope that it will be useful,
|
42
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
43
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
44
|
+
# General Public License for more details.
|
45
|
+
#
|
46
|
+
# The full text of the GPL is available at:
|
47
|
+
#
|
48
|
+
# https://www.gnu.org/licenses/
|
49
|
+
# ****************************************************************************
|
50
|
+
from __future__ import annotations
|
51
|
+
from sage.combinat.posets.lattices import LatticePoset, MeetSemilattice
|
52
|
+
|
53
|
+
|
54
|
+
def paths_in_triangle(i, j, a, b) -> list[tuple[int, ...]]:
|
55
|
+
r"""
|
56
|
+
Return all Dyck paths from `(0,0)` to `(i,j)` in the `(a \times
|
57
|
+
b)`-rectangle.
|
58
|
+
|
59
|
+
This means that at each step of the path, one has `a y \geq b x`.
|
60
|
+
|
61
|
+
A path is represented by a sequence of `0` and `1`, where `0` is an
|
62
|
+
horizontal step `(1,0)` and `1` is a vertical step `(0,1)`.
|
63
|
+
|
64
|
+
INPUT:
|
65
|
+
|
66
|
+
- ``a``, ``b`` -- integers with `a \geq b`
|
67
|
+
|
68
|
+
- ``i``, ``j`` -- nonnegative integers with `1 \geq \frac{j}{b} \geq
|
69
|
+
\frac{i}{a} \geq 0`
|
70
|
+
|
71
|
+
OUTPUT: list of paths
|
72
|
+
|
73
|
+
EXAMPLES::
|
74
|
+
|
75
|
+
sage: from sage.combinat.tamari_lattices import paths_in_triangle
|
76
|
+
sage: paths_in_triangle(2,2,2,2)
|
77
|
+
[(1, 0, 1, 0), (1, 1, 0, 0)]
|
78
|
+
sage: paths_in_triangle(2,3,4,4)
|
79
|
+
[(1, 0, 1, 0, 1), (1, 1, 0, 0, 1), (1, 0, 1, 1, 0),
|
80
|
+
(1, 1, 0, 1, 0), (1, 1, 1, 0, 0)]
|
81
|
+
sage: paths_in_triangle(2,1,4,4)
|
82
|
+
Traceback (most recent call last):
|
83
|
+
...
|
84
|
+
ValueError: the endpoint is not valid
|
85
|
+
sage: paths_in_triangle(3,2,5,3)
|
86
|
+
[(1, 0, 1, 0, 0), (1, 1, 0, 0, 0)]
|
87
|
+
"""
|
88
|
+
if not (b >= j and j * a >= i * b and i >= 0):
|
89
|
+
raise ValueError("the endpoint is not valid")
|
90
|
+
|
91
|
+
if i == 0:
|
92
|
+
return [tuple([1] * j)]
|
93
|
+
|
94
|
+
if (j - 1) * a >= (i) * b:
|
95
|
+
result = [u + (1,) for u in paths_in_triangle(i, j - 1, a, b)]
|
96
|
+
result += [u + (0,) for u in paths_in_triangle(i - 1, j, a, b)]
|
97
|
+
return result
|
98
|
+
|
99
|
+
return [u + (0,) for u in paths_in_triangle(i - 1, j, a, b)]
|
100
|
+
|
101
|
+
|
102
|
+
def swap(p, i, m=1) -> tuple[int, ...]:
|
103
|
+
r"""
|
104
|
+
Perform a covering move in the `(a,b)`-Tamari lattice of slope parameter `m`.
|
105
|
+
|
106
|
+
The letter at position `i` in `p` must be a `0`, followed by at
|
107
|
+
least one `1`.
|
108
|
+
|
109
|
+
INPUT:
|
110
|
+
|
111
|
+
- ``p`` -- a Dyck path in the `(a \times b)`-rectangle
|
112
|
+
|
113
|
+
- ``i`` -- integer between `0` and `a+b-1`
|
114
|
+
|
115
|
+
OUTPUT: a Dyck path in the `(a \times b)`-rectangle
|
116
|
+
|
117
|
+
EXAMPLES::
|
118
|
+
|
119
|
+
sage: from sage.combinat.tamari_lattices import swap
|
120
|
+
sage: swap((1,0,1,0,0),1)
|
121
|
+
(1, 1, 0, 0, 0)
|
122
|
+
sage: swap((1,1,0,0,1,1,0,0,0),3)
|
123
|
+
(1, 1, 0, 1, 1, 0, 0, 0, 0)
|
124
|
+
sage: swap((1,0,1,0,1,0,0,0), 1, 1)
|
125
|
+
(1, 1, 0, 0, 1, 0, 0, 0)
|
126
|
+
sage: swap((1,0,1,0,1,0,0,0), 1, 5/3)
|
127
|
+
(1, 1, 0, 1, 0, 0, 0, 0)
|
128
|
+
|
129
|
+
|
130
|
+
TESTS::
|
131
|
+
|
132
|
+
sage: swap((1,0,1,0),6)
|
133
|
+
Traceback (most recent call last):
|
134
|
+
...
|
135
|
+
ValueError: the index is greater than the length of the path
|
136
|
+
sage: swap((1,1,0,0,1,1,0,0),2)
|
137
|
+
Traceback (most recent call last):
|
138
|
+
...
|
139
|
+
ValueError: there is no such covering move
|
140
|
+
"""
|
141
|
+
if i >= len(p):
|
142
|
+
raise ValueError("the index is greater than the length of the path")
|
143
|
+
if i == len(p) - 1 or p[i + 1] == 0:
|
144
|
+
raise ValueError("there is no such covering move")
|
145
|
+
|
146
|
+
found = False
|
147
|
+
height = 0
|
148
|
+
j = i
|
149
|
+
while not found and j <= len(p) - 2:
|
150
|
+
j += 1
|
151
|
+
if p[j]:
|
152
|
+
height += m
|
153
|
+
else:
|
154
|
+
height -= 1
|
155
|
+
if height <= 0:
|
156
|
+
found = True
|
157
|
+
q = list(p)
|
158
|
+
for k in range(i, j):
|
159
|
+
q[k] = p[k + 1]
|
160
|
+
q[j] = 0
|
161
|
+
return tuple(q)
|
162
|
+
|
163
|
+
|
164
|
+
def GeneralizedTamariLattice(a, b, m=1):
|
165
|
+
r"""
|
166
|
+
Return the `(a,b)`-Tamari lattice of parameter `m`.
|
167
|
+
|
168
|
+
INPUT:
|
169
|
+
|
170
|
+
- ``a``, ``b`` -- integers with `a \geq b`
|
171
|
+
|
172
|
+
- ``m`` -- a nonnegative rational number such that `a \geq b m`
|
173
|
+
|
174
|
+
OUTPUT:
|
175
|
+
|
176
|
+
- a finite lattice (special case of the alt `\nu`-Tamari lattices in [CC2023]_)
|
177
|
+
|
178
|
+
The elements of the lattice are
|
179
|
+
:func:`Dyck paths<sage.combinat.dyck_word.DyckWord>` in the
|
180
|
+
`(a \times b)`-rectangle.
|
181
|
+
|
182
|
+
The parameter `m` (slope) is used only to define the covering relations.
|
183
|
+
When the slope `m` is `0`, two paths are comparable if and only if
|
184
|
+
one is always above the other.
|
185
|
+
|
186
|
+
The usual :wikipedia:`Tamari lattice<Tamari_lattice>` of index `b`
|
187
|
+
is the special case `a=b+1` and `m=1`.
|
188
|
+
|
189
|
+
Other special cases give the `m`-Tamari lattices studied in [BMFPR2011]_,
|
190
|
+
or the rational Tamari lattices when a and b are coprime and m = a/b (see [PRV2017]_).
|
191
|
+
|
192
|
+
EXAMPLES::
|
193
|
+
|
194
|
+
sage: from sage.combinat.tamari_lattices import GeneralizedTamariLattice
|
195
|
+
sage: GeneralizedTamariLattice(3,2)
|
196
|
+
Finite lattice containing 2 elements
|
197
|
+
sage: GeneralizedTamariLattice(4,3)
|
198
|
+
Finite lattice containing 5 elements
|
199
|
+
sage: GeneralizedTamariLattice(7,5,2)
|
200
|
+
Traceback (most recent call last):
|
201
|
+
...
|
202
|
+
ValueError: the condition a>=b*m does not hold
|
203
|
+
sage: P = GeneralizedTamariLattice(5,3); P
|
204
|
+
Finite lattice containing 7 elements
|
205
|
+
sage: P = GeneralizedTamariLattice(5, 3, m=5/3); P
|
206
|
+
Finite lattice containing 7 elements
|
207
|
+
|
208
|
+
|
209
|
+
TESTS::
|
210
|
+
|
211
|
+
sage: P.coxeter_transformation()**18 == 1 # needs sage.libs.flint
|
212
|
+
True
|
213
|
+
|
214
|
+
REFERENCES:
|
215
|
+
|
216
|
+
- [BMFPR2011]_
|
217
|
+
|
218
|
+
- [PRV2017]_
|
219
|
+
|
220
|
+
- [CC2023]_
|
221
|
+
"""
|
222
|
+
if a < b * m:
|
223
|
+
raise ValueError("the condition a>=b*m does not hold")
|
224
|
+
|
225
|
+
def covers(p):
|
226
|
+
return [swap(p, i, m) for i in range(len(p) - 1)
|
227
|
+
if not p[i] and p[i + 1]]
|
228
|
+
return LatticePoset({p: covers(p)
|
229
|
+
for p in paths_in_triangle(a, b, a, b)}, check=False)
|
230
|
+
|
231
|
+
|
232
|
+
def TamariLattice(n, m=1):
|
233
|
+
r"""
|
234
|
+
Return the `n`-th Tamari lattice.
|
235
|
+
|
236
|
+
Using the slope parameter `m`, one can also get the `m`-Tamari lattices.
|
237
|
+
|
238
|
+
INPUT:
|
239
|
+
|
240
|
+
- ``n`` -- nonnegative integer (the index)
|
241
|
+
|
242
|
+
- ``m`` -- nonnegative integer (the slope, default: 1)
|
243
|
+
|
244
|
+
OUTPUT: a finite lattice
|
245
|
+
|
246
|
+
In the usual case, the elements of the lattice are :func:`Dyck
|
247
|
+
paths<sage.combinat.dyck_word.DyckWord>` in the `(n+1 \times
|
248
|
+
n)`-rectangle. For a general slope `m`, the elements are Dyck
|
249
|
+
paths in the `(m n+1 \times n)`-rectangle.
|
250
|
+
|
251
|
+
See :wikipedia:`Tamari lattice<Tamari_lattice>` for mathematical
|
252
|
+
background.
|
253
|
+
|
254
|
+
EXAMPLES::
|
255
|
+
|
256
|
+
sage: posets.TamariLattice(3)
|
257
|
+
Finite lattice containing 5 elements
|
258
|
+
|
259
|
+
sage: posets.TamariLattice(3, 2)
|
260
|
+
Finite lattice containing 12 elements
|
261
|
+
|
262
|
+
REFERENCES:
|
263
|
+
|
264
|
+
- [BMFPR2011]_
|
265
|
+
"""
|
266
|
+
return GeneralizedTamariLattice(m * n + 1, n, m)
|
267
|
+
|
268
|
+
|
269
|
+
# a variation : the Dexter meet-semilattices
|
270
|
+
|
271
|
+
|
272
|
+
def swap_dexter(p, i) -> list[tuple[int, ...]]:
|
273
|
+
r"""
|
274
|
+
Perform covering moves in the `(a,b)`-Dexter posets.
|
275
|
+
|
276
|
+
The letter at position `i` in `p` must be a `0`, followed by at
|
277
|
+
least one `1`.
|
278
|
+
|
279
|
+
INPUT:
|
280
|
+
|
281
|
+
- ``p`` -- a Dyck path in the `(a \times b)`-rectangle
|
282
|
+
|
283
|
+
- ``i`` -- integer between `0` and `a+b-1`
|
284
|
+
|
285
|
+
OUTPUT:
|
286
|
+
|
287
|
+
- a list of Dyck paths in the `(a \times b)`-rectangle
|
288
|
+
|
289
|
+
EXAMPLES::
|
290
|
+
|
291
|
+
sage: from sage.combinat.tamari_lattices import swap_dexter
|
292
|
+
sage: swap_dexter((1,0,1,0,0),1)
|
293
|
+
[(1, 1, 0, 0, 0)]
|
294
|
+
sage: swap_dexter((1,1,0,0,1,1,0,0,0),3)
|
295
|
+
[(1, 1, 0, 1, 1, 0, 0, 0, 0), (1, 1, 1, 1, 0, 0, 0, 0, 0)]
|
296
|
+
sage: swap_dexter((1,1,0,1,0,0,0),2)
|
297
|
+
[]
|
298
|
+
|
299
|
+
TESTS::
|
300
|
+
|
301
|
+
sage: swap_dexter((1,0,1,0,0),6)
|
302
|
+
Traceback (most recent call last):
|
303
|
+
...
|
304
|
+
ValueError: the index is greater than the length of the path
|
305
|
+
|
306
|
+
sage: swap_dexter((1,1,0,0,1,1,0,0,0),2)
|
307
|
+
Traceback (most recent call last):
|
308
|
+
...
|
309
|
+
ValueError: there is no such covering move
|
310
|
+
"""
|
311
|
+
m = 1
|
312
|
+
|
313
|
+
if i >= len(p):
|
314
|
+
raise ValueError("the index is greater than the length of the path")
|
315
|
+
if i == len(p) - 1 or p[i + 1] == 0:
|
316
|
+
raise ValueError("there is no such covering move")
|
317
|
+
|
318
|
+
found = False
|
319
|
+
height = 0
|
320
|
+
j = i
|
321
|
+
while not found and j <= len(p) - 2:
|
322
|
+
j += 1
|
323
|
+
if p[j]:
|
324
|
+
height += m
|
325
|
+
else:
|
326
|
+
height -= 1
|
327
|
+
if height == 0:
|
328
|
+
found = True
|
329
|
+
if not (j == len(p) - 2 or p[j + 1]): # forbidden moves
|
330
|
+
return []
|
331
|
+
|
332
|
+
resu = []
|
333
|
+
tp = tuple(p)
|
334
|
+
for deb in range(i, 0, -1):
|
335
|
+
if not p[deb]:
|
336
|
+
q = tp[:deb] + tp[i + 1: j + 1] + tp[deb: i + 1] + tp[j + 1:]
|
337
|
+
resu.append(q)
|
338
|
+
else:
|
339
|
+
break
|
340
|
+
return resu
|
341
|
+
|
342
|
+
|
343
|
+
def DexterSemilattice(n):
|
344
|
+
r"""
|
345
|
+
Return the `n`-th Dexter meet-semilattice.
|
346
|
+
|
347
|
+
INPUT:
|
348
|
+
|
349
|
+
- ``n`` -- nonnegative integer (the index)
|
350
|
+
|
351
|
+
OUTPUT: a finite meet-semilattice
|
352
|
+
|
353
|
+
The elements of the semilattice are :func:`Dyck
|
354
|
+
paths<sage.combinat.dyck_word.DyckWord>` in the `(n+1 \times
|
355
|
+
n)`-rectangle.
|
356
|
+
|
357
|
+
EXAMPLES::
|
358
|
+
|
359
|
+
sage: posets.DexterSemilattice(3)
|
360
|
+
Finite meet-semilattice containing 5 elements
|
361
|
+
|
362
|
+
sage: P = posets.DexterSemilattice(4); P
|
363
|
+
Finite meet-semilattice containing 14 elements
|
364
|
+
sage: len(P.maximal_chains())
|
365
|
+
15
|
366
|
+
sage: len(P.maximal_elements())
|
367
|
+
4
|
368
|
+
sage: P.chain_polynomial() # needs sage.libs.flint
|
369
|
+
q^5 + 19*q^4 + 47*q^3 + 42*q^2 + 14*q + 1
|
370
|
+
|
371
|
+
REFERENCES:
|
372
|
+
|
373
|
+
- [Cha18]_
|
374
|
+
"""
|
375
|
+
a = n + 1
|
376
|
+
b = n
|
377
|
+
|
378
|
+
def covers_dexter(p):
|
379
|
+
data = [swap_dexter(p, i) for i in range(len(p) - 1)
|
380
|
+
if not p[i] and p[i + 1]]
|
381
|
+
return [cov for L in data for cov in L]
|
382
|
+
return MeetSemilattice({p: covers_dexter(p)
|
383
|
+
for p in paths_in_triangle(a, b, a, b)},
|
384
|
+
check=False)
|