passagemath-graphs 10.5.10__cp39-cp39-macosx_14_0_arm64.whl → 10.5.43__cp39-cp39-macosx_14_0_arm64.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.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/METADATA +126 -30
- passagemath_graphs-10.5.43.dist-info/RECORD +256 -0
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/WHEEL +2 -1
- passagemath_graphs.dylibs/libgmp.10.dylib +0 -0
- sage/all__sagemath_graphs.py +5 -0
- sage/combinat/abstract_tree.py +1 -1
- sage/combinat/binary_tree.py +1 -1
- sage/combinat/cluster_algebra_quiver/all.py +1 -1
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +28 -24
- sage/combinat/cluster_algebra_quiver/interact.py +4 -0
- sage/combinat/designs/MOLS_handbook_data.py +5 -5
- sage/combinat/designs/bibd.py +10 -9
- sage/combinat/designs/covering_array.py +3 -3
- sage/combinat/designs/covering_design.py +2 -1
- sage/combinat/designs/database.py +11 -10
- sage/combinat/designs/designs_pyx.cpython-39-darwin.so +0 -0
- sage/combinat/designs/designs_pyx.pyx +13 -45
- sage/combinat/designs/difference_family.py +6 -6
- sage/combinat/designs/difference_matrices.py +1 -1
- sage/combinat/designs/evenly_distributed_sets.cpython-39-darwin.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +15 -22
- sage/combinat/designs/ext_rep.py +9 -14
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-darwin.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +1 -1
- sage/combinat/designs/group_divisible_designs.py +1 -1
- sage/combinat/designs/incidence_structures.py +8 -8
- sage/combinat/designs/latin_squares.py +1 -1
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +8 -7
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-darwin.so +0 -0
- sage/combinat/designs/resolvable_bibd.py +1 -1
- sage/combinat/designs/steiner_quadruple_systems.py +1 -1
- sage/combinat/designs/subhypergraph_search.cpython-39-darwin.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +9 -9
- sage/combinat/finite_state_machine_generators.py +2 -2
- sage/combinat/graph_path.py +3 -3
- sage/combinat/interval_posets.py +10 -10
- sage/combinat/ordered_tree.py +1 -1
- sage/combinat/posets/cartesian_product.py +1 -1
- sage/combinat/posets/d_complete.py +1 -1
- sage/combinat/posets/forest.py +1 -1
- sage/combinat/posets/hasse_cython.cpython-39-darwin.so +0 -0
- sage/combinat/posets/hasse_diagram.py +8 -6
- sage/combinat/posets/incidence_algebras.py +8 -8
- sage/combinat/posets/lattices.py +28 -4
- sage/combinat/posets/linear_extension_iterator.cpython-39-darwin.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +2 -0
- sage/combinat/posets/linear_extensions.py +7 -16
- sage/combinat/posets/moebius_algebra.py +1 -1
- sage/combinat/posets/poset_examples.py +1 -1
- sage/combinat/posets/posets.py +54 -56
- sage/combinat/rooted_tree.py +3 -3
- sage/combinat/tamari_lattices.py +1 -1
- 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/asteroidal_triples.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.pxd +1 -1
- sage/graphs/base/boost_graph.pyx +1 -1
- sage/graphs/base/c_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/c_graph.pxd +4 -4
- sage/graphs/base/c_graph.pyx +270 -184
- sage/graphs/base/dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/graph_backends.cpython-39-darwin.so +0 -0
- sage/graphs/base/sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.pyx +93 -6
- sage/graphs/base/static_sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_graph.pyx +1 -1
- sage/graphs/bipartite_graph.py +0 -1
- sage/graphs/centrality.cpython-39-darwin.so +0 -0
- sage/graphs/centrality.pyx +0 -0
- sage/graphs/comparability.cpython-39-darwin.so +0 -0
- sage/graphs/comparability.pyx +172 -138
- sage/graphs/connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/connectivity.pyx +194 -18
- sage/graphs/convexity_properties.cpython-39-darwin.so +0 -0
- sage/graphs/digraph_generators.py +118 -74
- sage/graphs/distances_all_pairs.cpython-39-darwin.so +0 -0
- sage/graphs/distances_all_pairs.pyx +145 -27
- sage/graphs/edge_connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/generators/basic.py +471 -130
- sage/graphs/generators/distance_regular.cpython-39-darwin.so +0 -0
- sage/graphs/generators/distance_regular.pyx +12 -12
- sage/graphs/generators/families.py +2 -2
- sage/graphs/generators/random.py +8 -13
- sage/graphs/generators/smallgraphs.py +12 -11
- sage/graphs/generic_graph.py +687 -265
- sage/graphs/generic_graph_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/genus.cpython-39-darwin.so +0 -0
- sage/graphs/graph.py +12 -46
- sage/graphs/graph_coloring.cpython-39-darwin.so +0 -0
- sage/graphs/graph_database.py +1 -1
- sage/graphs/graph_decompositions/bandwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/graph_products.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-39-darwin.so +0 -0
- sage/graphs/graph_generators.py +110 -55
- sage/graphs/graph_generators_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/graph_latex.py +1 -1
- sage/graphs/graph_list.py +2 -3
- sage/graphs/graph_plot.py +225 -30
- sage/graphs/hyperbolicity.cpython-39-darwin.so +0 -0
- sage/graphs/independent_sets.cpython-39-darwin.so +0 -0
- sage/graphs/isgci.py +3 -8
- sage/graphs/isoperimetric_inequalities.cpython-39-darwin.so +0 -0
- sage/graphs/line_graph.cpython-39-darwin.so +0 -0
- sage/graphs/matching.py +14 -25
- sage/graphs/matching_covered_graph.py +871 -60
- sage/graphs/orientations.py +190 -134
- sage/graphs/path_enumeration.cpython-39-darwin.so +0 -0
- sage/graphs/path_enumeration.pyx +25 -25
- sage/graphs/spanning_tree.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.pyx +54 -52
- sage/graphs/traversals.cpython-39-darwin.so +0 -0
- sage/graphs/traversals.pyx +114 -46
- sage/graphs/trees.cpython-39-darwin.so +0 -0
- sage/graphs/views.cpython-39-darwin.so +0 -0
- sage/graphs/weakly_chordal.cpython-39-darwin.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-darwin.so +0 -0
- sage/knots/free_knotinfo_monoid.py +2 -3
- sage/knots/knot.py +1 -1
- sage/knots/knotinfo.py +4 -4
- sage/knots/link.py +58 -57
- sage/sandpiles/sandpile.py +2 -3
- sage/topology/cell_complex.py +1 -1
- sage/topology/cubical_complex.py +7 -7
- sage/topology/delta_complex.py +4 -4
- sage/topology/simplicial_complex.py +7 -22
- passagemath_graphs-10.5.10.dist-info/RECORD +0 -251
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.rings.finite_rings
|
3
3
|
r"""
|
4
|
-
Group-
|
4
|
+
Group-divisible designs (GDD)
|
5
5
|
|
6
6
|
This module gathers everything related to Group-Divisible Designs. The
|
7
7
|
constructions defined here can be accessed through ``designs.<tab>``::
|
@@ -365,11 +365,11 @@ class IncidenceStructure:
|
|
365
365
|
True
|
366
366
|
sage: ["Am", "I", "finally", "done ?"] in IS
|
367
367
|
False
|
368
|
-
sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), # needs sage.combinat
|
368
|
+
sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), # needs sage.combinat sage.modules
|
369
369
|
....: point_coordinates=False)
|
370
|
-
sage: [3,8,7] in IS # needs sage.combinat
|
370
|
+
sage: [3,8,7] in IS # needs sage.combinat sage.modules
|
371
371
|
True
|
372
|
-
sage: [3,8,9] in IS # needs sage.combinat
|
372
|
+
sage: [3,8,9] in IS # needs sage.combinat sage.modules
|
373
373
|
False
|
374
374
|
"""
|
375
375
|
try:
|
@@ -1508,10 +1508,10 @@ class IncidenceStructure:
|
|
1508
1508
|
sage: BD.is_t_design(0,6,3,7) or BD.is_t_design(0,7,4,7) or BD.is_t_design(0,7,3,8)
|
1509
1509
|
False
|
1510
1510
|
|
1511
|
-
sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) # needs sage.combinat
|
1512
|
-
sage: BD.is_t_design(1) # needs sage.combinat
|
1511
|
+
sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) # needs sage.combinat sage.modules
|
1512
|
+
sage: BD.is_t_design(1) # needs sage.combinat sage.modules
|
1513
1513
|
True
|
1514
|
-
sage: BD.is_t_design(2) # needs sage.combinat
|
1514
|
+
sage: BD.is_t_design(2) # needs sage.combinat sage.modules
|
1515
1515
|
True
|
1516
1516
|
|
1517
1517
|
Steiner triple and quadruple systems are other names for `2-(v,3,1)` and
|
@@ -1924,8 +1924,8 @@ class IncidenceStructure:
|
|
1924
1924
|
sage: TD.is_resolvable()
|
1925
1925
|
True
|
1926
1926
|
|
1927
|
-
sage: AG = designs.AffineGeometryDesign(3,1,GF(2)) # needs sage.combinat
|
1928
|
-
sage: AG.is_resolvable() # needs sage.combinat
|
1927
|
+
sage: AG = designs.AffineGeometryDesign(3,1,GF(2)) # needs sage.combinat sage.modules
|
1928
|
+
sage: AG.is_resolvable() # needs sage.combinat sage.modules
|
1929
1929
|
True
|
1930
1930
|
|
1931
1931
|
Their classes::
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.modules
|
3
3
|
r"""
|
4
|
-
Mutually
|
4
|
+
Mutually orthogonal Latin squares (MOLS)
|
5
5
|
|
6
6
|
The main function of this module is :func:`mutually_orthogonal_latin_squares`
|
7
7
|
and can be can be used to generate MOLS (or check that they exist)::
|
@@ -257,7 +257,7 @@ def construction_3_5(k, n, m, r, s, t, explain_construction=False):
|
|
257
257
|
group_k_3 = [B[-1] for B in master_design if B[-3] not in group_k_1 and B[-2] not in group_k_2]
|
258
258
|
group_k_3 = list(set(group_k_3))
|
259
259
|
assert len(group_k_3) <= t
|
260
|
-
group_k_3.extend(
|
260
|
+
group_k_3.extend(x for x in range(q) if x not in group_k_3)
|
261
261
|
group_k_3 = group_k_3[:t]
|
262
262
|
|
263
263
|
# Relabelling the OA
|
@@ -546,7 +546,7 @@ def construction_q_x(k, q, x, check=True, explain_construction=False):
|
|
546
546
|
# delete points.
|
547
547
|
#
|
548
548
|
# TD.extend([range(i*q,(i+1)*q) for i in range(x)])
|
549
|
-
TD.extend(
|
549
|
+
TD.extend(list(range(i*q,(i+1)*q))+[p2] for i in range(x,q))
|
550
550
|
|
551
551
|
points_to_delete = set([i*q+j for i in range(x) for j in range(1,q)]+[i*q for i in range(x,q)])
|
552
552
|
points_to_keep = set(range(q**2+2))-points_to_delete
|
@@ -838,14 +838,14 @@ def thwart_lemma_4_1(k, n, m, explain_construction=False):
|
|
838
838
|
# - (1+t,t,1+t), (1,1,1), (1+t,t,t), (1,1,2), (0,0,1), (1,0,1), (0,1,1+t),
|
839
839
|
# (0,1,1), (1,0,-t)
|
840
840
|
points = [(1+t,t,1+t), (1,1,1), (1+t,t,t), (1,1,2), (0,0,1), (1,0,1), (0,1,1+t), (0,1,1), (1,0,-t)]
|
841
|
-
points = [[K(
|
841
|
+
points = [[K(c) for c in t] for t in points] # triples of K^3
|
842
842
|
AG_2_3 = []
|
843
843
|
for x,y,z in points:
|
844
844
|
if z != 0:
|
845
|
-
x,y,z = x/z,y/z,
|
845
|
+
x, y, z = x / z, y / z, K.one()
|
846
846
|
AG_2_3.append(relabel[x]+n*relabel[y])
|
847
847
|
elif y != 0:
|
848
|
-
x,y
|
848
|
+
x, y = x / y, K.one()
|
849
849
|
AG_2_3.append(q**2+relabel[x])
|
850
850
|
else:
|
851
851
|
AG_2_3.append(q**2+q)
|
@@ -1003,7 +1003,7 @@ def three_factor_product(k, n1, n2, n3, check=False, explain_construction=False)
|
|
1003
1003
|
Rolf S. Rees,
|
1004
1004
|
Journal of Combinatorial Designs 1.1 (1993): 15-26.
|
1005
1005
|
"""
|
1006
|
-
assert n1 <= n2
|
1006
|
+
assert n1 <= n2 <= n3
|
1007
1007
|
|
1008
1008
|
if explain_construction:
|
1009
1009
|
return ("Three-factor product with n={}.{}.{} from:\n" +
|
@@ -1569,7 +1569,8 @@ def brouwer_separable_design(k, t, q, x, check=False, verbose=False, explain_con
|
|
1569
1569
|
blocks_of_size_q_plus_t = _reorder_matrix(blocks_of_size_q_plus_t)
|
1570
1570
|
|
1571
1571
|
for i,classs in enumerate(OA_tq1_classes):
|
1572
|
-
OA.extend([R[xx] if xx < t+q else N-i-1 for xx in B]
|
1572
|
+
OA.extend([R[xx] if xx < t+q else N-i-1 for xx in B]
|
1573
|
+
for R in blocks_of_size_q_plus_t for B in classs)
|
1573
1574
|
|
1574
1575
|
# The set of size x
|
1575
1576
|
OA.extend([N-1-xx for xx in R] for R in orthogonal_array(k,x))
|
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.rings.finite_rings
|
3
3
|
r"""
|
4
|
-
Resolvable
|
4
|
+
Resolvable balanced incomplete block design (RBIBD)
|
5
5
|
|
6
6
|
This module contains everything related to resolvable Balanced Incomplete Block
|
7
7
|
Designs. The constructions implemented here can be obtained through the
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
r"""
|
3
|
-
Steiner
|
3
|
+
Steiner quadruple systems
|
4
4
|
|
5
5
|
A Steiner Quadruple System on `n` points is a family `SQS_n \subset \binom {[n]}
|
6
6
|
4` of `4`-sets, such that any set `S\subset [n]` of size three is a subset of
|
Binary file
|
@@ -179,21 +179,21 @@ cdef hypergraph h_init(int n, list H) noexcept:
|
|
179
179
|
"""
|
180
180
|
cdef int x,i
|
181
181
|
cdef hypergraph h
|
182
|
-
h.n
|
183
|
-
h.m
|
184
|
-
h.limbs
|
185
|
-
h.names
|
186
|
-
h.sets
|
187
|
-
h.set_space
|
182
|
+
h.n = n
|
183
|
+
h.m = len(H)
|
184
|
+
h.limbs = (n+63) // 64 # =ceil(n/64)
|
185
|
+
h.names = <int *> sig_malloc(sizeof(int)*n)
|
186
|
+
h.sets = <uint64_t **> sig_malloc(h.m*sizeof(uint64_t *))
|
187
|
+
h.set_space = <uint64_t *> sig_calloc(h.m*(h.limbs+1),sizeof(uint64_t))
|
188
188
|
|
189
189
|
# Consistency check
|
190
190
|
for S in H:
|
191
191
|
for x in S:
|
192
|
-
if x<0 or x>=n:
|
192
|
+
if x < 0 or x >= n:
|
193
193
|
h.n = -1
|
194
194
|
|
195
|
-
if (h.names
|
196
|
-
h.sets
|
195
|
+
if (h.names == NULL or
|
196
|
+
h.sets == NULL or
|
197
197
|
h.set_space == NULL or
|
198
198
|
h.n == -1):
|
199
199
|
h.n = -1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.graphs sage.modules
|
3
3
|
r"""
|
4
|
-
Common
|
4
|
+
Common automata and transducers (finite state machines generators)
|
5
5
|
|
6
|
-
Automata and
|
6
|
+
Automata and transducers in Sage can be built through the
|
7
7
|
:class:`automata <AutomatonGenerators>`
|
8
8
|
and :class:`transducers <TransducerGenerators>` objects, respectively.
|
9
9
|
It contains generators for
|
sage/combinat/graph_path.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
r"""
|
3
|
-
Paths in
|
3
|
+
Paths in directed acyclic graphs
|
4
4
|
"""
|
5
|
-
|
5
|
+
# ****************************************************************************
|
6
6
|
# Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,
|
7
7
|
#
|
8
8
|
# Distributed under the terms of the GNU General Public License (GPL)
|
@@ -15,7 +15,7 @@ Paths in Directed Acyclic Graphs
|
|
15
15
|
# The full text of the GPL is available at:
|
16
16
|
#
|
17
17
|
# http://www.gnu.org/licenses/
|
18
|
-
|
18
|
+
# ****************************************************************************
|
19
19
|
|
20
20
|
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
|
21
21
|
from sage.structure.parent import Parent
|
sage/combinat/interval_posets.py
CHANGED
@@ -48,6 +48,7 @@ from sage.misc.latex import latex
|
|
48
48
|
from sage.misc.lazy_attribute import lazy_attribute
|
49
49
|
from sage.misc.lazy_import import lazy_import
|
50
50
|
from sage.rings.integer import Integer
|
51
|
+
from sage.rings.integer_ring import ZZ
|
51
52
|
from sage.rings.semirings.non_negative_integer_semiring import NN
|
52
53
|
from sage.sets.non_negative_integers import NonNegativeIntegers
|
53
54
|
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
|
@@ -593,8 +594,8 @@ class TamariIntervalPoset(Element,
|
|
593
594
|
n = self._size
|
594
595
|
m = other.size()
|
595
596
|
relations = self._poset.cover_relations()
|
596
|
-
relations.extend(
|
597
|
-
|
597
|
+
relations.extend((i + n, j + n)
|
598
|
+
for i, j in other._poset.cover_relations_iterator())
|
598
599
|
P = FinitePoset(DiGraph([list(range(1, n + m + 1)), relations],
|
599
600
|
format='vertices_and_edges')) # type:ignore
|
600
601
|
return TamariIntervalPoset(P, check=False) # type:ignore
|
@@ -1981,9 +1982,9 @@ class TamariIntervalPoset(Element,
|
|
1981
1982
|
relations = [(i - start + 1, j - start + 1)
|
1982
1983
|
for (i, j) in self.increasing_cover_relations()
|
1983
1984
|
if i >= start and j < end]
|
1984
|
-
relations.extend(
|
1985
|
-
|
1986
|
-
|
1985
|
+
relations.extend((j - start + 1, i - start + 1)
|
1986
|
+
for (j, i) in self.decreasing_cover_relations()
|
1987
|
+
if i >= start and j < end)
|
1987
1988
|
return TamariIntervalPoset(end - start, relations, check=False)
|
1988
1989
|
|
1989
1990
|
sub_poset = subposet
|
@@ -3111,7 +3112,7 @@ class TamariIntervalPosets(UniqueRepresentation, Parent):
|
|
3111
3112
|
rroots, rrelations, rindex = get_relations(bt[1], start=index + 1)
|
3112
3113
|
roots.append(index)
|
3113
3114
|
relations.extend(rrelations)
|
3114
|
-
relations.extend(
|
3115
|
+
relations.extend((j, index) for j in rroots)
|
3115
3116
|
return roots, relations, rindex
|
3116
3117
|
|
3117
3118
|
_, relations, index = get_relations(binary_tree)
|
@@ -3225,7 +3226,7 @@ class TamariIntervalPosets(UniqueRepresentation, Parent):
|
|
3225
3226
|
roots, relations, rindex = get_relations(bt[1], start=index + 1)
|
3226
3227
|
roots.append(index)
|
3227
3228
|
relations.extend(lrelations)
|
3228
|
-
relations.extend(
|
3229
|
+
relations.extend((j, index) for j in lroots)
|
3229
3230
|
return roots, relations, rindex
|
3230
3231
|
|
3231
3232
|
_, relations, index = get_relations(binary_tree)
|
@@ -3758,11 +3759,10 @@ class TamariIntervalPosets_size(TamariIntervalPosets):
|
|
3758
3759
|
sage: [TamariIntervalPosets(i).cardinality() for i in range(6)]
|
3759
3760
|
[1, 1, 3, 13, 68, 399]
|
3760
3761
|
"""
|
3761
|
-
from sage.arith.misc import binomial
|
3762
3762
|
n = self._size
|
3763
3763
|
if n == 0:
|
3764
|
-
return
|
3765
|
-
return (2 *
|
3764
|
+
return ZZ.one()
|
3765
|
+
return (2 * Integer(4 * n + 1).binomial(n - 1)) // (n * (n + 1))
|
3766
3766
|
# return Integer(2 * factorial(4*n+1)/(factorial(n+1)*factorial(3*n+2)))
|
3767
3767
|
|
3768
3768
|
def __iter__(self) -> Iterator[TIP]:
|
sage/combinat/ordered_tree.py
CHANGED
sage/combinat/posets/forest.py
CHANGED
Binary file
|
@@ -2102,14 +2102,16 @@ class HasseDiagram(DiGraph):
|
|
2102
2102
|
for e in orbit:
|
2103
2103
|
orbit_number[e] = ind
|
2104
2104
|
|
2105
|
-
comps = [None] * n
|
2106
2105
|
mt = self.meet_matrix()
|
2107
2106
|
jn = self.join_matrix()
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2107
|
+
|
2108
|
+
items = ((e, dual_isomorphism[e]) for e in range(n))
|
2109
|
+
|
2110
|
+
# Fix following after issue #20727
|
2111
|
+
comps = [[x for x in range(n)
|
2112
|
+
if mt[e, x] == 0 and jn[e, x] == n - 1 and
|
2113
|
+
x in orbits[orbit_number[dual_e]]]
|
2114
|
+
for e, dual_e in items]
|
2113
2115
|
|
2114
2116
|
# Fitting is done by this recursive function:
|
2115
2117
|
def recursive_fit(orthocomplements, unbinded):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.modules
|
3
3
|
r"""
|
4
|
-
Incidence
|
4
|
+
Incidence algebras
|
5
5
|
"""
|
6
6
|
# ****************************************************************************
|
7
7
|
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
|
@@ -12,6 +12,8 @@ Incidence Algebras
|
|
12
12
|
# (at your option) any later version.
|
13
13
|
# https://www.gnu.org/licenses/
|
14
14
|
# ****************************************************************************
|
15
|
+
from copy import copy
|
16
|
+
from typing import Any
|
15
17
|
|
16
18
|
from sage.misc.cachefunc import cached_method
|
17
19
|
from sage.misc.lazy_attribute import lazy_attribute
|
@@ -20,8 +22,6 @@ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
|
|
20
22
|
from sage.combinat.free_module import CombinatorialFreeModule
|
21
23
|
from sage.matrix.matrix_space import MatrixSpace
|
22
24
|
|
23
|
-
from copy import copy
|
24
|
-
|
25
25
|
|
26
26
|
class IncidenceAlgebra(CombinatorialFreeModule):
|
27
27
|
r"""
|
@@ -450,22 +450,22 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
|
|
450
450
|
sage: TestSuite(R).run() # long time
|
451
451
|
"""
|
452
452
|
self._ambient = I
|
453
|
-
EC = {}
|
453
|
+
EC: dict[Any, list] = {}
|
454
454
|
P = self._ambient._poset
|
455
455
|
if not P.is_finite():
|
456
456
|
raise NotImplementedError("only implemented for finite posets")
|
457
457
|
for i in self._ambient.basis().keys():
|
458
458
|
S = P.subposet(P.interval(*i))
|
459
459
|
added = False
|
460
|
-
for k in EC:
|
460
|
+
for k, ECk in EC.items():
|
461
461
|
if S._hasse_diagram.is_isomorphic(k._hasse_diagram):
|
462
|
-
|
462
|
+
ECk.append(i)
|
463
463
|
added = True
|
464
464
|
break
|
465
465
|
if not added:
|
466
466
|
EC[S] = [i]
|
467
|
-
|
468
|
-
self._equiv_classes = {cls[0]: cls for cls in
|
467
|
+
equiv_classes = map(sorted, EC.values())
|
468
|
+
self._equiv_classes = {cls[0]: cls for cls in equiv_classes}
|
469
469
|
cat = Algebras(I.base_ring()).FiniteDimensional().WithBasis()
|
470
470
|
CombinatorialFreeModule.__init__(self, I.base_ring(),
|
471
471
|
sorted(self._equiv_classes.keys()),
|
sage/combinat/posets/lattices.py
CHANGED
@@ -1293,7 +1293,8 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
|
|
1293
1293
|
|
1294
1294
|
- Weaker properties: :meth:`is_join_semidistributive`,
|
1295
1295
|
:meth:`is_meet_semidistributive`
|
1296
|
-
- Stronger properties: :meth:`is_distributive
|
1296
|
+
- Stronger properties: :meth:`is_distributive`,
|
1297
|
+
:meth:`is_congruence_uniform`
|
1297
1298
|
|
1298
1299
|
TESTS::
|
1299
1300
|
|
@@ -3553,7 +3554,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
|
|
3553
3554
|
True
|
3554
3555
|
"""
|
3555
3556
|
# Rationale for naming of elements: a lattice can have
|
3556
|
-
# elements 1, (1, 1), (1, (1, 1)) and so on. We
|
3557
|
+
# elements 1, (1, 1), (1, (1, 1)) and so on. We cannot just
|
3557
3558
|
# make a copy of S with elements (s, 1).
|
3558
3559
|
|
3559
3560
|
# The construction could be defined for any convex
|
@@ -3958,7 +3959,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
|
|
3958
3959
|
|
3959
3960
|
Add a certificate-option.
|
3960
3961
|
"""
|
3961
|
-
# Todo: This can be made much faster, if we
|
3962
|
+
# Todo: This can be made much faster, if we do not regenerate meet- and
|
3962
3963
|
# join-matrices every time, but instead remove some rows and columns
|
3963
3964
|
# from them.
|
3964
3965
|
|
@@ -4274,7 +4275,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
|
|
4274
4275
|
|
4275
4276
|
The congruence lattice of this lattice has maximal chains satisfying the needed
|
4276
4277
|
property, but also maximal chains not satisfying that; this shows that the code
|
4277
|
-
|
4278
|
+
cannot be optimized to test just some maximal chain::
|
4278
4279
|
|
4279
4280
|
sage: L = LatticePoset(DiGraph('QSO?I?_?_GBG??_??a???@?K??A??B???C??s??G??I??@??A??@???'))
|
4280
4281
|
sage: L.is_constructible_by_doublings('convex') # needs sage.combinat
|
@@ -4347,6 +4348,29 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
|
|
4347
4348
|
todo.append(e_up)
|
4348
4349
|
return False
|
4349
4350
|
|
4351
|
+
def is_congruence_uniform(self) -> bool:
|
4352
|
+
"""
|
4353
|
+
Return whether ``self`` is congruence uniform.
|
4354
|
+
|
4355
|
+
This is equivalent to being constructible by doubling intervals.
|
4356
|
+
|
4357
|
+
.. SEEALSO:: :meth:`is_constructible_by_doublings`
|
4358
|
+
|
4359
|
+
EXAMPLES::
|
4360
|
+
|
4361
|
+
sage: P = posets.PentagonPoset()
|
4362
|
+
sage: P.is_congruence_uniform()
|
4363
|
+
True
|
4364
|
+
sage: P = posets.DiamondPoset(5)
|
4365
|
+
sage: P.is_congruence_uniform()
|
4366
|
+
False
|
4367
|
+
|
4368
|
+
REFERENCES:
|
4369
|
+
|
4370
|
+
- [Day1979]_
|
4371
|
+
"""
|
4372
|
+
return self.is_constructible_by_doublings(type="interval")
|
4373
|
+
|
4350
4374
|
def is_isoform(self, certificate=False):
|
4351
4375
|
"""
|
4352
4376
|
Return ``True`` if the lattice is isoform and ``False`` otherwise.
|
Binary file
|
@@ -160,6 +160,8 @@ def _linear_extension_gen(_D, list _le, list _a, list _b, list _is_plus, Py_ssiz
|
|
160
160
|
if i == -1:
|
161
161
|
return
|
162
162
|
|
163
|
+
import sage.matrix # otherwise there will be a lot of "Exception ignored in: 'linear_extension_iterator._linear_extension_right_b'"
|
164
|
+
|
163
165
|
for e in _linear_extension_gen(_D, _le, _a, _b, _is_plus, i-1):
|
164
166
|
yield e
|
165
167
|
mrb = 0
|
@@ -1,16 +1,6 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
r"""
|
3
|
-
Linear
|
4
|
-
|
5
|
-
This module defines two classes:
|
6
|
-
|
7
|
-
- :class:`LinearExtensionOfPoset`
|
8
|
-
- :class:`LinearExtensionsOfPoset`
|
9
|
-
- :class:`LinearExtensionsOfPosetWithHooks`
|
10
|
-
- :class:`LinearExtensionsOfForest`
|
11
|
-
|
12
|
-
Classes and methods
|
13
|
-
-------------------
|
3
|
+
Linear extensions of posets
|
14
4
|
"""
|
15
5
|
# ****************************************************************************
|
16
6
|
# Copyright (C) 2012 Anne Schilling <anne at math.ucdavis.edu>
|
@@ -532,7 +522,7 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
|
|
532
522
|
True
|
533
523
|
sage: L._poset is P
|
534
524
|
True
|
535
|
-
sage: TestSuite(L).run()
|
525
|
+
sage: TestSuite(L).run() # needs sage.modules
|
536
526
|
|
537
527
|
sage: P = Poset((divisors(15), attrcall("divides")))
|
538
528
|
sage: L = P.linear_extensions()
|
@@ -628,12 +618,12 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
|
|
628
618
|
for x in range(n):
|
629
619
|
# Use the existing Jup table to compute all covering
|
630
620
|
# relations in J(P) for things that are above loc(x).
|
631
|
-
|
621
|
+
K0 = [[loc[x]]]
|
632
622
|
j = 0
|
633
|
-
while
|
634
|
-
|
623
|
+
while K0[j]:
|
624
|
+
K0.append([b for a in K0[j] for b in Jup[a]])
|
635
625
|
j += 1
|
636
|
-
K = sorted({item for sublist in
|
626
|
+
K = sorted({item for sublist in K0 for item in sublist})
|
637
627
|
for j in range(len(K)):
|
638
628
|
i = m + j + 1
|
639
629
|
Jup[i] = [m + K.index(a) + 1 for a in Jup[K[j]]]
|
@@ -732,6 +722,7 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
|
|
732
722
|
|
733
723
|
EXAMPLES::
|
734
724
|
|
725
|
+
sage: # needs sage.modules
|
735
726
|
sage: P = Poset(([1,2,3,4], [[1,3],[1,4],[2,3]]), linear_extension=True)
|
736
727
|
sage: L = P.linear_extensions()
|
737
728
|
sage: G = L.markov_chain_digraph(); G
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
# sage.doctest: needs sage.modules
|
3
3
|
r"""
|
4
|
-
Möbius
|
4
|
+
Möbius algebras
|
5
5
|
"""
|
6
6
|
# ****************************************************************************
|
7
7
|
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>,
|
@@ -1591,7 +1591,7 @@ class Posets(metaclass=ClasscallMetaclass):
|
|
1591
1591
|
|
1592
1592
|
edges = [(i, i + 1) for i in range(1, n)]
|
1593
1593
|
edges.extend([(n, n + 1), (n, n + 2), (n + 1, n + 3), (n + 2, n + 3)])
|
1594
|
-
edges.extend(
|
1594
|
+
edges.extend((i, i + 1) for i in range(n + 3, 2 * n + 2))
|
1595
1595
|
p = DiGraph([list(range(1, 2 * n + 3)), edges])
|
1596
1596
|
return DCompletePoset(p)
|
1597
1597
|
|