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
sage/combinat/posets/posets.py
CHANGED
@@ -293,7 +293,6 @@ from itertools import product
|
|
293
293
|
from sage.misc.cachefunc import cached_method
|
294
294
|
from sage.misc.lazy_attribute import lazy_attribute
|
295
295
|
from sage.misc.misc_c import prod
|
296
|
-
from sage.arith.misc import binomial
|
297
296
|
from sage.categories.category import Category
|
298
297
|
from sage.categories.sets_cat import Sets
|
299
298
|
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
|
@@ -700,15 +699,12 @@ def Poset(data=None, element_labels=None, cover_relations=False, linear_extensio
|
|
700
699
|
if element_labels is not None:
|
701
700
|
P = P.relabel(element_labels)
|
702
701
|
return P
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
else:
|
707
|
-
return FinitePoset(data, elements=element_labels, category=category, facade=facade)
|
702
|
+
if element_labels is None:
|
703
|
+
return FinitePoset(data, elements=data._elements, category=category, facade=facade)
|
704
|
+
return FinitePoset(data, elements=element_labels, category=category, facade=facade)
|
708
705
|
|
709
706
|
# Convert data to a DiGraph
|
710
707
|
elements = None
|
711
|
-
D = {}
|
712
708
|
if data is None: # type 0
|
713
709
|
D = DiGraph()
|
714
710
|
elif isinstance(data, DiGraph): # type 4
|
@@ -914,6 +910,8 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
914
910
|
sage: Q = Poset([[1,2],[],[1]])
|
915
911
|
sage: Q == P
|
916
912
|
False
|
913
|
+
|
914
|
+
sage: # needs nauty
|
917
915
|
sage: p1, p2 = Posets(2).list()
|
918
916
|
sage: p2 == p1, p1 != p2
|
919
917
|
(False, True)
|
@@ -927,9 +925,9 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
927
925
|
[False, False, True, False, False],
|
928
926
|
[False, False, False, True, False],
|
929
927
|
[False, False, False, False, True]]
|
930
|
-
|
931
928
|
sage: [[p1.__ne__(p2) for p1 in Posets(2)] for p2 in Posets(2)]
|
932
929
|
[[False, True], [True, False]]
|
930
|
+
|
933
931
|
sage: P = Poset([[1,2,4],[3],[3]])
|
934
932
|
sage: Q = Poset([[1,2],[],[1],[4]])
|
935
933
|
sage: P != Q
|
@@ -938,7 +936,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
938
936
|
False
|
939
937
|
sage: Q != Q
|
940
938
|
False
|
941
|
-
sage: [[p1.__ne__(p2) for p1 in Posets(2)] for p2 in Posets(2)]
|
939
|
+
sage: [[p1.__ne__(p2) for p1 in Posets(2)] for p2 in Posets(2)] # needs nauty
|
942
940
|
[[False, True], [True, False]]
|
943
941
|
|
944
942
|
sage: P = Poset((divisors(12), attrcall("divides")), linear_extension=True)
|
@@ -1530,10 +1528,11 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
1530
1528
|
sage: P.sorted([], allow_incomparable=False, remove_duplicates=False)
|
1531
1529
|
[]
|
1532
1530
|
"""
|
1533
|
-
v =
|
1531
|
+
v = (self._element_to_vertex(x) for x in l)
|
1534
1532
|
if remove_duplicates:
|
1535
|
-
|
1536
|
-
|
1533
|
+
o = sorted(set(v))
|
1534
|
+
else:
|
1535
|
+
o = sorted(v)
|
1537
1536
|
|
1538
1537
|
if not allow_incomparable:
|
1539
1538
|
H = self._hasse_diagram
|
@@ -1818,7 +1817,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
1818
1817
|
for r in range(1, n + 1):
|
1819
1818
|
new_a_spec.append(0)
|
1820
1819
|
for i in range(max(1, r - n + k), min(r, k) + 1):
|
1821
|
-
k_val =
|
1820
|
+
k_val = Integer(r - 1).binomial(i - 1) * Integer(n - r).binomial(k - i)
|
1822
1821
|
new_a_spec[-1] += k_val * a_spec[i - 1] * n_lin_exts
|
1823
1822
|
return new_a_spec
|
1824
1823
|
|
@@ -2059,10 +2058,10 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
2059
2058
|
'cover_colors': 'edge_colors',
|
2060
2059
|
'cover_style': 'edge_style',
|
2061
2060
|
'border': 'graph_border'}
|
2062
|
-
for param in rename:
|
2061
|
+
for param, value in rename.items():
|
2063
2062
|
tmp = kwds.pop(param, None)
|
2064
2063
|
if tmp is not None:
|
2065
|
-
kwds[
|
2064
|
+
kwds[value] = tmp
|
2066
2065
|
|
2067
2066
|
heights = kwds.pop('heights', None)
|
2068
2067
|
if heights is None:
|
@@ -2587,10 +2586,10 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
2587
2586
|
|
2588
2587
|
covers = []
|
2589
2588
|
for a, b in ints:
|
2590
|
-
covers.extend([
|
2589
|
+
covers.extend([(a, b), (a, bb)] for bb in self.upper_covers(b))
|
2591
2590
|
if a != b:
|
2592
|
-
covers.extend([
|
2593
|
-
|
2591
|
+
covers.extend([(a, b), (aa, b)] for aa in self.upper_covers(a)
|
2592
|
+
if self.le(aa, b))
|
2594
2593
|
|
2595
2594
|
dg = DiGraph([ints, covers], format='vertices_and_edges')
|
2596
2595
|
return constructor(dg, cover_relations=True)
|
@@ -2717,10 +2716,9 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
2717
2716
|
for y in H.neighbor_out_iterator(xmax):
|
2718
2717
|
if exposant == 1:
|
2719
2718
|
next_stock.append((xmin, y, y))
|
2720
|
-
|
2721
|
-
if (
|
2722
|
-
|
2723
|
-
next_stock.append((xmin, cov_xmin, y))
|
2719
|
+
elif (cov_xmin, y) in short_stock:
|
2720
|
+
if H.is_linear_interval(xmin, y):
|
2721
|
+
next_stock.append((xmin, cov_xmin, y))
|
2724
2722
|
if next_stock:
|
2725
2723
|
poly.append(len(next_stock))
|
2726
2724
|
stock = next_stock
|
@@ -2857,12 +2855,12 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
2857
2855
|
closure = self._hasse_diagram.transitive_closure()
|
2858
2856
|
for m, n in chain_pairs:
|
2859
2857
|
try:
|
2860
|
-
|
2858
|
+
ZZm, ZZn = Integer(m), Integer(n)
|
2861
2859
|
except TypeError:
|
2862
2860
|
raise TypeError(f"{m} and {n} must be integers")
|
2863
2861
|
if m < 1 or n < 1:
|
2864
2862
|
raise ValueError(f"{m} and {n} must be positive integers")
|
2865
|
-
twochains = digraphs.TransitiveTournament(
|
2863
|
+
twochains = digraphs.TransitiveTournament(ZZm) + digraphs.TransitiveTournament(ZZn)
|
2866
2864
|
if closure.subgraph_search(twochains, induced=True) is not None:
|
2867
2865
|
return False
|
2868
2866
|
return True
|
@@ -3212,7 +3210,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
3212
3210
|
sage: N5.has_isomorphic_subposet(D)
|
3213
3211
|
True
|
3214
3212
|
|
3215
|
-
sage: len([P for P in Posets(5) if P.has_isomorphic_subposet(D)])
|
3213
|
+
sage: len([P for P in Posets(5) if P.has_isomorphic_subposet(D)]) # needs nauty
|
3216
3214
|
11
|
3217
3215
|
"""
|
3218
3216
|
if not hasattr(other, 'hasse_diagram'):
|
@@ -3246,7 +3244,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
3246
3244
|
False
|
3247
3245
|
sage: Poset({1:[]}).is_bounded() # Here top == bottom
|
3248
3246
|
True
|
3249
|
-
sage: ( len([P for P in Posets(5) if P.is_bounded()]) ==
|
3247
|
+
sage: ( len([P for P in Posets(5) if P.is_bounded()]) == # needs nauty
|
3250
3248
|
....: Posets(3).cardinality() )
|
3251
3249
|
True
|
3252
3250
|
"""
|
@@ -3273,7 +3271,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
3273
3271
|
|
3274
3272
|
TESTS::
|
3275
3273
|
|
3276
|
-
sage: [len([P for P in Posets(n) if P.is_chain()]) for n in range(5)]
|
3274
|
+
sage: [len([P for P in Posets(n) if P.is_chain()]) for n in range(5)] # needs nauty
|
3277
3275
|
[1, 1, 1, 1, 1]
|
3278
3276
|
"""
|
3279
3277
|
return self._hasse_diagram.is_chain()
|
@@ -4398,7 +4396,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
4398
4396
|
[1, 1, 1, 1, x^5 + x^4 + x + 1]
|
4399
4397
|
sage: P.coxeter_smith_form(algorithm='gap') # needs sage.libs.gap
|
4400
4398
|
[1, 1, 1, 1, x^5 + x^4 + x + 1]
|
4401
|
-
sage: P.coxeter_smith_form(algorithm='pari') # needs sage.libs.pari
|
4399
|
+
sage: P.coxeter_smith_form(algorithm='pari') # needs sage.libs.flint sage.libs.pari
|
4402
4400
|
[1, 1, 1, 1, x^5 + x^4 + x + 1]
|
4403
4401
|
sage: P.coxeter_smith_form(algorithm='fricas') # optional - fricas
|
4404
4402
|
[1, 1, 1, 1, x^5 + x^4 + x + 1]
|
@@ -4500,7 +4498,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
4500
4498
|
|
4501
4499
|
sage: Poset().is_meet_semilattice() # Test empty lattice
|
4502
4500
|
True
|
4503
|
-
sage: len([P for P in Posets(4) if P.is_meet_semilattice()])
|
4501
|
+
sage: len([P for P in Posets(4) if P.is_meet_semilattice()]) # needs nauty
|
4504
4502
|
5
|
4505
4503
|
|
4506
4504
|
sage: P = Poset({1: [2], 3: []})
|
@@ -4571,7 +4569,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
4571
4569
|
|
4572
4570
|
sage: Poset().is_join_semilattice() # Test empty lattice
|
4573
4571
|
True
|
4574
|
-
sage: len([P for P in Posets(4) if P.is_join_semilattice()])
|
4572
|
+
sage: len([P for P in Posets(4) if P.is_join_semilattice()]) # needs nauty
|
4575
4573
|
5
|
4576
4574
|
|
4577
4575
|
sage: X = Poset({1: [3], 2: [3], 3: [4, 5]})
|
@@ -5299,7 +5297,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
5299
5297
|
dg = self._hasse_diagram
|
5300
5298
|
if not dg.is_connected():
|
5301
5299
|
raise NotImplementedError('the poset is not connected')
|
5302
|
-
if
|
5300
|
+
if Integer(dg.num_verts()).is_prime():
|
5303
5301
|
return [self]
|
5304
5302
|
G = dg.to_undirected()
|
5305
5303
|
is_product, dic = G.is_cartesian_product(relabeling=True)
|
@@ -5310,7 +5308,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
5310
5308
|
prod_dg = dg.relabel(dic, inplace=False)
|
5311
5309
|
v0 = next(iter(dic.values()))
|
5312
5310
|
n = len(v0)
|
5313
|
-
factors_range =
|
5311
|
+
factors_range = range(n)
|
5314
5312
|
fusion = Graph(n)
|
5315
5313
|
|
5316
5314
|
def edge_color(va, vb):
|
@@ -5325,9 +5323,9 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
5325
5323
|
neigh1 = [z for z in prod_dg.neighbor_iterator(x)
|
5326
5324
|
if edge_color(x, z) == i1]
|
5327
5325
|
for x0, x1 in product(neigh0, neigh1):
|
5328
|
-
|
5329
|
-
|
5330
|
-
x2 = tuple(
|
5326
|
+
_x2 = list(x0)
|
5327
|
+
_x2[i1] = x1[i1]
|
5328
|
+
x2 = tuple(_x2)
|
5331
5329
|
A0 = prod_dg.has_edge(x, x0)
|
5332
5330
|
B0 = prod_dg.has_edge(x1, x2)
|
5333
5331
|
if A0 != B0:
|
@@ -6496,7 +6494,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
6496
6494
|
with seed(currseed):
|
6497
6495
|
for _ in range(count):
|
6498
6496
|
for element in range(n):
|
6499
|
-
if random() % 2
|
6497
|
+
if random() % 2: # should use one random bit
|
6500
6498
|
s = [state[i] for i in lower_covers[element]]
|
6501
6499
|
if 1 not in s:
|
6502
6500
|
if 2 not in s:
|
@@ -6531,7 +6529,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
6531
6529
|
|
6532
6530
|
EXAMPLES::
|
6533
6531
|
|
6534
|
-
sage: set_random_seed(0) # results are
|
6532
|
+
sage: set_random_seed(0) # results are reproducible
|
6535
6533
|
sage: P = posets.BooleanLattice(4)
|
6536
6534
|
sage: P.random_maximal_chain()
|
6537
6535
|
[0, 4, 5, 7, 15]
|
@@ -6566,7 +6564,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
6566
6564
|
|
6567
6565
|
EXAMPLES::
|
6568
6566
|
|
6569
|
-
sage: set_random_seed(0) # results are
|
6567
|
+
sage: set_random_seed(0) # results are reproducible
|
6570
6568
|
sage: P = posets.BooleanLattice(4)
|
6571
6569
|
sage: P.random_maximal_antichain()
|
6572
6570
|
[1, 8, 2, 4]
|
@@ -6598,7 +6596,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
6598
6596
|
|
6599
6597
|
EXAMPLES::
|
6600
6598
|
|
6601
|
-
sage: set_random_seed(0) # results are
|
6599
|
+
sage: set_random_seed(0) # results are reproducible
|
6602
6600
|
sage: P = posets.BooleanLattice(4)
|
6603
6601
|
sage: P.random_linear_extension()
|
6604
6602
|
[0, 4, 1, 2, 3, 8, 10, 5, 12, 9, 13, 11, 6, 14, 7, 15]
|
@@ -7172,12 +7170,12 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7172
7170
|
True
|
7173
7171
|
"""
|
7174
7172
|
from sage.geometry.polyhedron.constructor import Polyhedron
|
7175
|
-
ineqs = [[0] + [
|
7173
|
+
ineqs = [[0] + [Integer(j == v) - Integer(j == u) for j in self]
|
7176
7174
|
for u, v in self.hasse_diagram().edges(sort=False, labels=False)]
|
7177
7175
|
for i in self.maximal_elements():
|
7178
|
-
ineqs += [[1] + [-
|
7176
|
+
ineqs += [[1] + [-Integer(j == i) for j in self]]
|
7179
7177
|
for i in self.minimal_elements():
|
7180
|
-
ineqs += [[0] + [
|
7178
|
+
ineqs += [[0] + [Integer(j == i) for j in self]]
|
7181
7179
|
return Polyhedron(ieqs=ineqs, base_ring=ZZ)
|
7182
7180
|
|
7183
7181
|
def chain_polytope(self):
|
@@ -7211,10 +7209,10 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7211
7209
|
A 5-dimensional polyhedron in ZZ^5 defined as the convex hull of 8 vertices
|
7212
7210
|
"""
|
7213
7211
|
from sage.geometry.polyhedron.constructor import Polyhedron
|
7214
|
-
ineqs = [[1] + [-
|
7212
|
+
ineqs = [[1] + [-Integer(j in chain) for j in self]
|
7215
7213
|
for chain in self.maximal_chains_iterator()]
|
7216
7214
|
for i in self:
|
7217
|
-
ineqs += [[0] + [
|
7215
|
+
ineqs += [[0] + [Integer(j == i) for j in self]]
|
7218
7216
|
return Polyhedron(ieqs=ineqs, base_ring=ZZ)
|
7219
7217
|
|
7220
7218
|
def zeta_polynomial(self):
|
@@ -7243,15 +7241,14 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7243
7241
|
|
7244
7242
|
EXAMPLES::
|
7245
7243
|
|
7244
|
+
sage: # needs sage.libs.flint
|
7246
7245
|
sage: posets.ChainPoset(2).zeta_polynomial()
|
7247
7246
|
q
|
7248
7247
|
sage: posets.ChainPoset(3).zeta_polynomial()
|
7249
7248
|
1/2*q^2 + 1/2*q
|
7250
|
-
|
7251
7249
|
sage: P = posets.PentagonPoset()
|
7252
7250
|
sage: P.zeta_polynomial()
|
7253
7251
|
1/6*q^3 + q^2 - 1/6*q
|
7254
|
-
|
7255
7252
|
sage: P = posets.DiamondPoset(5)
|
7256
7253
|
sage: P.zeta_polynomial()
|
7257
7254
|
3/2*q^2 - 1/2*q
|
@@ -7260,6 +7257,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7260
7257
|
|
7261
7258
|
Checking the simplest cases::
|
7262
7259
|
|
7260
|
+
sage: # needs sage.libs.flint
|
7263
7261
|
sage: Poset({}).zeta_polynomial()
|
7264
7262
|
0
|
7265
7263
|
sage: Poset({1: []}).zeta_polynomial()
|
@@ -7657,28 +7655,27 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7657
7655
|
|
7658
7656
|
EXAMPLES::
|
7659
7657
|
|
7658
|
+
sage: # needs sage.libs.flint
|
7660
7659
|
sage: P = posets.ChainPoset(3)
|
7661
7660
|
sage: t = P.chain_polynomial(); t
|
7662
7661
|
q^3 + 3*q^2 + 3*q + 1
|
7663
7662
|
sage: t(1) == len(list(P.chains()))
|
7664
7663
|
True
|
7665
|
-
|
7666
7664
|
sage: P = posets.BooleanLattice(3)
|
7667
7665
|
sage: P.chain_polynomial()
|
7668
7666
|
6*q^4 + 18*q^3 + 19*q^2 + 8*q + 1
|
7669
|
-
|
7670
7667
|
sage: P = posets.AntichainPoset(5)
|
7671
7668
|
sage: P.chain_polynomial()
|
7672
7669
|
5*q + 1
|
7673
7670
|
|
7674
7671
|
TESTS::
|
7675
7672
|
|
7673
|
+
sage: # needs sage.libs.flint
|
7676
7674
|
sage: P = Poset()
|
7677
7675
|
sage: P.chain_polynomial()
|
7678
7676
|
1
|
7679
7677
|
sage: parent(P.chain_polynomial())
|
7680
7678
|
Univariate Polynomial Ring in q over Integer Ring
|
7681
|
-
|
7682
7679
|
sage: R = Poset({1: []})
|
7683
7680
|
sage: R.chain_polynomial()
|
7684
7681
|
q + 1
|
@@ -7699,10 +7696,10 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
7699
7696
|
|
7700
7697
|
EXAMPLES::
|
7701
7698
|
|
7699
|
+
sage: # needs sage.libs.flint
|
7702
7700
|
sage: P = posets.AntichainPoset(3)
|
7703
7701
|
sage: P.order_polynomial()
|
7704
7702
|
q^3
|
7705
|
-
|
7706
7703
|
sage: P = posets.ChainPoset(3)
|
7707
7704
|
sage: f = P.order_polynomial(); f
|
7708
7705
|
1/6*q^3 + 1/2*q^2 + 1/3*q
|
@@ -8145,7 +8142,7 @@ class FinitePoset(UniqueRepresentation, Parent):
|
|
8145
8142
|
n = self.cardinality()
|
8146
8143
|
if n == 1:
|
8147
8144
|
return True
|
8148
|
-
if k is None and not certificate and n % 2
|
8145
|
+
if k is None and not certificate and n % 2:
|
8149
8146
|
return False
|
8150
8147
|
|
8151
8148
|
H = self._hasse_diagram
|
@@ -8881,6 +8878,7 @@ class FinitePosets_n(UniqueRepresentation, Parent):
|
|
8881
8878
|
|
8882
8879
|
EXAMPLES::
|
8883
8880
|
|
8881
|
+
sage: # needs nauty
|
8884
8882
|
sage: P = Posets(3)
|
8885
8883
|
sage: P.cardinality()
|
8886
8884
|
5
|
@@ -8902,7 +8900,7 @@ class FinitePosets_n(UniqueRepresentation, Parent):
|
|
8902
8900
|
Category of finite enumerated sets
|
8903
8901
|
sage: P.__class__
|
8904
8902
|
<class 'sage.combinat.posets.posets.FinitePosets_n_with_category'>
|
8905
|
-
sage: TestSuite(P).run()
|
8903
|
+
sage: TestSuite(P).run() # needs nauty
|
8906
8904
|
"""
|
8907
8905
|
Parent.__init__(self, category=FiniteEnumeratedSets())
|
8908
8906
|
self._n = n
|
@@ -8945,13 +8943,13 @@ class FinitePosets_n(UniqueRepresentation, Parent):
|
|
8945
8943
|
EXAMPLES::
|
8946
8944
|
|
8947
8945
|
sage: P = Posets(2)
|
8948
|
-
sage: list(P)
|
8946
|
+
sage: list(P) # needs nauty
|
8949
8947
|
[Finite poset containing 2 elements, Finite poset containing 2 elements]
|
8950
8948
|
|
8951
8949
|
TESTS::
|
8952
8950
|
|
8953
|
-
sage: it = iter(Posets(17))
|
8954
|
-
sage: next(it)
|
8951
|
+
sage: it = iter(Posets(17)) # needs nauty
|
8952
|
+
sage: next(it) # needs nauty
|
8955
8953
|
Finite poset containing 17 elements
|
8956
8954
|
"""
|
8957
8955
|
if self._n <= 16:
|
@@ -8981,7 +8979,7 @@ class FinitePosets_n(UniqueRepresentation, Parent):
|
|
8981
8979
|
sage: P = Posets(3)
|
8982
8980
|
sage: P.cardinality()
|
8983
8981
|
5
|
8984
|
-
sage: P.cardinality(from_iterator=True)
|
8982
|
+
sage: P.cardinality(from_iterator=True) # needs nauty
|
8985
8983
|
5
|
8986
8984
|
"""
|
8987
8985
|
# Obtained from The On-Line Encyclopedia of Integer Sequences;
|
sage/combinat/rooted_tree.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-graphs
|
2
2
|
r"""
|
3
|
-
Rooted (
|
3
|
+
Rooted (unordered) trees
|
4
4
|
|
5
5
|
AUTHORS:
|
6
6
|
|
@@ -193,8 +193,8 @@ class RootedTree(AbstractClonableTree, NormalizedClonableList,
|
|
193
193
|
children = list(children)
|
194
194
|
except TypeError:
|
195
195
|
raise TypeError(f"input ({children}) is not a valid tree")
|
196
|
-
#if not (children.__class__ is self.__class__
|
197
|
-
#
|
196
|
+
# if not (children.__class__ is self.__class__
|
197
|
+
# and children.parent() == parent):
|
198
198
|
children = [self.__class__(parent, x) for x in children]
|
199
199
|
NormalizedClonableList.__init__(self, parent, children, check=check)
|
200
200
|
|
sage/combinat/tamari_lattices.py
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
* (show-structure ssz4 6)
|
2
|
+
|
3
|
+
Dimension = 0:
|
4
|
+
|
5
|
+
Vertices : (<<GBar>>)
|
6
|
+
|
7
|
+
Dimension = 1:
|
8
|
+
|
9
|
+
Dimension = 2:
|
10
|
+
|
11
|
+
Simplex : <<GBar<- (2)><- NIL>>>
|
12
|
+
|
13
|
+
Faces : (<AbSm 0 <<GBar>>> <AbSm 0 <<GBar>>> <AbSm 0 <<GBar>>>)
|
14
|
+
|
15
|
+
Simplex : <<GBar<- (1)><- NIL>>>
|
16
|
+
|
17
|
+
Faces : (<AbSm 0 <<GBar>>> <AbSm 0 <<GBar>>> <AbSm 0 <<GBar>>>)
|
18
|
+
|
19
|
+
Dimension = 3:
|
20
|
+
|
21
|
+
Simplex : <<GBar<- (1 1)><0 NIL><- NIL>>>
|
22
|
+
|
23
|
+
Faces : (<AbSm - <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (2)><- NIL>>>> <AbSm - <<GBar<- (1)><- NIL>>>> <AbSm 1-0 <<GBar>>>)
|
24
|
+
|
25
|
+
Simplex : <<GBar<1 (1)><- (1)><- NIL>>>
|
26
|
+
|
27
|
+
Faces : (<AbSm 1-0 <<GBar>>> <AbSm - <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (2)><- NIL>>>> <AbSm - <<GBar<- (1)><- NIL>>>>)
|
28
|
+
|
29
|
+
Simplex : <<GBar<0 (1)><- (1)><- NIL>>>
|
30
|
+
|
31
|
+
Faces : (<AbSm - <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (1)><- NIL>>>>)
|
32
|
+
|
33
|
+
Dimension = 4:
|
34
|
+
|
35
|
+
Simplex : <<GBar<1-0 (1)><1-0 NIL><- (1)><- NIL>>>
|
36
|
+
|
37
|
+
Faces : (<AbSm 0 <<GBar<- (1)><- NIL>>>> <AbSm 0 <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<0 (1)><- (1)><- NIL>>>> <AbSm 2 <<GBar<- (1)><- NIL>>>> <AbSm 2 <<GBar<- (1)><- NIL>>>>)
|
38
|
+
|
39
|
+
Simplex : <<GBar<2-0 (1)><1 (1)><0 NIL><- NIL>>>
|
40
|
+
|
41
|
+
Faces : (<AbSm 1 <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<1 (1)><- (1)><- NIL>>>> <AbSm - <<GBar<0 (1)><- (1)><- NIL>>>> <AbSm - <<GBar<- (1 1)><0 NIL><- NIL>>>> <AbSm 1 <<GBar<- (1)><- NIL>>>>)
|
42
|
+
|
43
|
+
Simplex : <<GBar<2-1 (1)><0 (1)><0 NIL><- NIL>>>
|
44
|
+
|
45
|
+
Faces : (<AbSm 2 <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<1 (1)><- (1)><- NIL>>>> <AbSm 1 <<GBar<- (1)><- NIL>>>> <AbSm - <<GBar<- (1 1)><0 NIL><- NIL>>>> <AbSm 0 <<GBar<- (1)><- NIL>>>>)
|