passagemath-graphs 10.5.43__cp312-cp312-macosx_14_0_arm64.whl → 10.6.1rc2__cp312-cp312-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.
Files changed (132) hide show
  1. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/METADATA +5 -6
  2. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/RECORD +132 -130
  3. sage/combinat/abstract_tree.py +188 -17
  4. sage/combinat/cluster_algebra_quiver/interact.py +1 -2
  5. sage/combinat/cluster_algebra_quiver/mutation_type.py +518 -519
  6. sage/combinat/cluster_algebra_quiver/quiver.py +233 -205
  7. sage/combinat/designs/covering_design.py +2 -6
  8. sage/combinat/designs/database.py +11 -10
  9. sage/combinat/designs/designs_pyx.cpython-312-darwin.so +0 -0
  10. sage/combinat/designs/designs_pyx.pyx +2 -2
  11. sage/combinat/designs/evenly_distributed_sets.cpython-312-darwin.so +0 -0
  12. sage/combinat/designs/evenly_distributed_sets.pyx +4 -4
  13. sage/combinat/designs/gen_quadrangles_with_spread.cpython-312-darwin.so +0 -0
  14. sage/combinat/designs/latin_squares.py +53 -20
  15. sage/combinat/designs/orthogonal_arrays.py +2 -1
  16. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-312-darwin.so +0 -0
  17. sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +22 -21
  18. sage/combinat/designs/resolvable_bibd.py +191 -157
  19. sage/combinat/designs/subhypergraph_search.cpython-312-darwin.so +0 -0
  20. sage/combinat/designs/subhypergraph_search.pyx +4 -4
  21. sage/combinat/designs/twographs.py +2 -2
  22. sage/combinat/finite_state_machine.py +6 -6
  23. sage/combinat/posets/bubble_shuffle.py +247 -0
  24. sage/combinat/posets/d_complete.py +3 -3
  25. sage/combinat/posets/elements.py +3 -3
  26. sage/combinat/posets/hasse_cython.cpython-312-darwin.so +0 -0
  27. sage/combinat/posets/hasse_cython.pyx +1 -1
  28. sage/combinat/posets/hasse_diagram.py +16 -22
  29. sage/combinat/posets/hochschild_lattice.py +158 -0
  30. sage/combinat/posets/incidence_algebras.py +14 -16
  31. sage/combinat/posets/lattices.py +51 -53
  32. sage/combinat/posets/linear_extension_iterator.cpython-312-darwin.so +0 -0
  33. sage/combinat/posets/linear_extensions.py +10 -12
  34. sage/combinat/posets/moebius_algebra.py +4 -4
  35. sage/combinat/posets/poset_examples.py +70 -23
  36. sage/combinat/posets/posets.py +294 -103
  37. sage/databases/knotinfo_db.py +2 -1
  38. sage/graphs/asteroidal_triples.cpython-312-darwin.so +0 -0
  39. sage/graphs/asteroidal_triples.pyx +24 -3
  40. sage/graphs/base/boost_graph.cpython-312-darwin.so +0 -0
  41. sage/graphs/base/boost_graph.pxd +3 -3
  42. sage/graphs/base/c_graph.cpython-312-darwin.so +0 -0
  43. sage/graphs/base/c_graph.pyx +1 -1
  44. sage/graphs/base/dense_graph.cpython-312-darwin.so +0 -0
  45. sage/graphs/base/dense_graph.pxd +5 -3
  46. sage/graphs/base/dense_graph.pyx +44 -0
  47. sage/graphs/base/graph_backends.cpython-312-darwin.so +0 -0
  48. sage/graphs/base/sparse_graph.cpython-312-darwin.so +0 -0
  49. sage/graphs/base/static_dense_graph.cpython-312-darwin.so +0 -0
  50. sage/graphs/base/static_sparse_backend.cpython-312-darwin.so +0 -0
  51. sage/graphs/base/static_sparse_backend.pyx +8 -5
  52. sage/graphs/base/static_sparse_graph.cpython-312-darwin.so +0 -0
  53. sage/graphs/base/static_sparse_graph.pyx +86 -15
  54. sage/graphs/bipartite_graph.py +59 -36
  55. sage/graphs/centrality.cpython-312-darwin.so +0 -0
  56. sage/graphs/centrality.pyx +82 -9
  57. sage/graphs/cographs.py +1 -1
  58. sage/graphs/comparability.cpython-312-darwin.so +0 -0
  59. sage/graphs/comparability.pyx +64 -26
  60. sage/graphs/connectivity.cpython-312-darwin.so +0 -0
  61. sage/graphs/convexity_properties.cpython-312-darwin.so +0 -0
  62. sage/graphs/convexity_properties.pyx +52 -9
  63. sage/graphs/digraph.py +439 -95
  64. sage/graphs/digraph_generators.py +174 -102
  65. sage/graphs/distances_all_pairs.cpython-312-darwin.so +0 -0
  66. sage/graphs/dot2tex_utils.py +1 -1
  67. sage/graphs/edge_connectivity.cpython-312-darwin.so +0 -0
  68. sage/graphs/generators/basic.py +1 -1
  69. sage/graphs/generators/distance_regular.cpython-312-darwin.so +0 -0
  70. sage/graphs/generators/distance_regular.pyx +1 -1
  71. sage/graphs/generators/families.py +37 -27
  72. sage/graphs/generators/random.py +2 -2
  73. sage/graphs/generators/smallgraphs.py +3 -3
  74. sage/graphs/generic_graph.py +558 -86
  75. sage/graphs/generic_graph_pyx.cpython-312-darwin.so +0 -0
  76. sage/graphs/generic_graph_pyx.pyx +58 -11
  77. sage/graphs/genus.cpython-312-darwin.so +0 -0
  78. sage/graphs/genus.pyx +3 -4
  79. sage/graphs/graph.py +291 -8
  80. sage/graphs/graph_coloring.cpython-312-darwin.so +0 -0
  81. sage/graphs/graph_database.py +67 -12
  82. sage/graphs/graph_decompositions/bandwidth.cpython-312-darwin.so +0 -0
  83. sage/graphs/graph_decompositions/clique_separators.cpython-312-darwin.so +0 -0
  84. sage/graphs/graph_decompositions/clique_separators.pyx +24 -3
  85. sage/graphs/graph_decompositions/cutwidth.cpython-312-darwin.so +0 -0
  86. sage/graphs/graph_decompositions/fast_digraph.cpython-312-darwin.so +0 -0
  87. sage/graphs/graph_decompositions/fast_digraph.pyx +1 -1
  88. sage/graphs/graph_decompositions/graph_products.cpython-312-darwin.so +0 -0
  89. sage/graphs/graph_decompositions/graph_products.pyx +67 -21
  90. sage/graphs/graph_decompositions/modular_decomposition.cpython-312-darwin.so +0 -0
  91. sage/graphs/graph_decompositions/slice_decomposition.cpython-312-darwin.so +0 -0
  92. sage/graphs/graph_decompositions/slice_decomposition.pyx +34 -8
  93. sage/graphs/graph_decompositions/tree_decomposition.cpython-312-darwin.so +0 -0
  94. sage/graphs/graph_decompositions/vertex_separation.cpython-312-darwin.so +0 -0
  95. sage/graphs/graph_generators.py +45 -32
  96. sage/graphs/graph_generators_pyx.cpython-312-darwin.so +0 -0
  97. sage/graphs/graph_generators_pyx.pyx +15 -15
  98. sage/graphs/graph_latex.py +1 -1
  99. sage/graphs/graph_list.py +52 -9
  100. sage/graphs/graph_plot.py +7 -0
  101. sage/graphs/hyperbolicity.cpython-312-darwin.so +0 -0
  102. sage/graphs/hyperbolicity.pyx +2 -0
  103. sage/graphs/independent_sets.cpython-312-darwin.so +0 -0
  104. sage/graphs/isoperimetric_inequalities.cpython-312-darwin.so +0 -0
  105. sage/graphs/isoperimetric_inequalities.pyx +42 -6
  106. sage/graphs/line_graph.cpython-312-darwin.so +0 -0
  107. sage/graphs/line_graph.pyx +153 -37
  108. sage/graphs/matching_covered_graph.py +84 -60
  109. sage/graphs/orientations.py +3 -18
  110. sage/graphs/path_enumeration.cpython-312-darwin.so +0 -0
  111. sage/graphs/path_enumeration.pyx +2 -2
  112. sage/graphs/spanning_tree.cpython-312-darwin.so +0 -0
  113. sage/graphs/strongly_regular_db.cpython-312-darwin.so +0 -0
  114. sage/graphs/strongly_regular_db.pyx +15 -15
  115. sage/graphs/traversals.cpython-312-darwin.so +0 -0
  116. sage/graphs/traversals.pyx +13 -12
  117. sage/graphs/trees.cpython-312-darwin.so +0 -0
  118. sage/graphs/tutte_polynomial.py +1 -1
  119. sage/graphs/views.cpython-312-darwin.so +0 -0
  120. sage/graphs/weakly_chordal.cpython-312-darwin.so +0 -0
  121. sage/graphs/weakly_chordal.pyx +50 -8
  122. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-312-darwin.so +0 -0
  123. sage/knots/free_knotinfo_monoid.py +3 -3
  124. sage/knots/knotinfo.py +102 -82
  125. sage/knots/link.py +72 -39
  126. sage/topology/cubical_complex.py +4 -5
  127. sage/topology/delta_complex.py +4 -4
  128. sage/topology/simplicial_complex.py +0 -1
  129. sage/topology/simplicial_complex_catalog.py +6 -0
  130. sage/topology/simplicial_complex_examples.py +4 -16
  131. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/WHEEL +0 -0
  132. {passagemath_graphs-10.5.43.dist-info → passagemath_graphs-10.6.1rc2.dist-info}/top_level.txt +0 -0
@@ -70,7 +70,7 @@ class IncidenceAlgebra(CombinatorialFreeModule):
70
70
  CombinatorialFreeModule.__init__(self, R, map(tuple, P.relations()),
71
71
  prefix=prefix, category=cat)
72
72
 
73
- def _repr_term(self, A):
73
+ def _repr_term(self, A) -> str:
74
74
  """
75
75
  Return a string representation of the term labeled by ``A``.
76
76
 
@@ -83,7 +83,7 @@ class IncidenceAlgebra(CombinatorialFreeModule):
83
83
  """
84
84
  return self.prefix() + str(list(A))
85
85
 
86
- def _repr_(self):
86
+ def _repr_(self) -> str:
87
87
  r"""
88
88
  Return a string representation of ``self``.
89
89
 
@@ -148,7 +148,7 @@ class IncidenceAlgebra(CombinatorialFreeModule):
148
148
  """
149
149
  return self._poset
150
150
 
151
- def some_elements(self):
151
+ def some_elements(self) -> list:
152
152
  """
153
153
  Return a list of elements of ``self``.
154
154
 
@@ -279,7 +279,7 @@ class IncidenceAlgebra(CombinatorialFreeModule):
279
279
  return self.monomial(A)
280
280
 
281
281
  @lazy_attribute
282
- def _linear_extension(self):
282
+ def _linear_extension(self) -> tuple:
283
283
  """
284
284
  Return a fixed linear extension of the defining poset of ``self``.
285
285
 
@@ -362,7 +362,7 @@ class IncidenceAlgebra(CombinatorialFreeModule):
362
362
  M.set_immutable()
363
363
  return M
364
364
 
365
- def is_unit(self):
365
+ def is_unit(self) -> bool:
366
366
  """
367
367
  Return if ``self`` is a unit.
368
368
 
@@ -471,7 +471,7 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
471
471
  sorted(self._equiv_classes.keys()),
472
472
  prefix=prefix, category=cat)
473
473
 
474
- def _repr_(self):
474
+ def _repr_(self) -> str:
475
475
  r"""
476
476
  Return a string representation of ``self``.
477
477
 
@@ -500,7 +500,7 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
500
500
  """
501
501
  return self._ambient._poset
502
502
 
503
- def some_elements(self):
503
+ def some_elements(self) -> list:
504
504
  """
505
505
  Return a list of elements of ``self``.
506
506
 
@@ -527,9 +527,7 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
527
527
  sage: R.one_basis()
528
528
  (0, 0)
529
529
  """
530
- for A in self.basis().keys():
531
- if A[0] == A[1]:
532
- return A
530
+ return next(A for A in self.basis().keys() if A[0] == A[1])
533
531
 
534
532
  def delta(self):
535
533
  """
@@ -644,7 +642,7 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
644
642
  sage: R[3, 11]
645
643
  R[(0, 1)]
646
644
 
647
- TESTS:
645
+ TESTS::
648
646
 
649
647
  sage: R[2, 5]
650
648
  Traceback (most recent call last):
@@ -660,10 +658,10 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
660
658
  if A not in self._ambient._poset.list():
661
659
  raise ValueError("not an element of the poset")
662
660
  return self.one()
663
- else:
664
- A = tuple(A)
665
- if len(A) != 2:
666
- raise ValueError("not an interval")
661
+
662
+ A = tuple(A)
663
+ if len(A) != 2:
664
+ raise ValueError("not an interval")
667
665
  for k in self._equiv_classes:
668
666
  if A in self._equiv_classes[k]:
669
667
  return self.monomial(k)
@@ -748,7 +746,7 @@ class ReducedIncidenceAlgebra(CombinatorialFreeModule):
748
746
  """
749
747
  return self.parent().lift(self).to_matrix()
750
748
 
751
- def is_unit(self):
749
+ def is_unit(self) -> bool:
752
750
  """
753
751
  Return if ``self`` is a unit.
754
752
 
@@ -757,7 +757,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
757
757
  """
758
758
  Element = LatticePosetElement
759
759
 
760
- def _repr_(self):
760
+ def _repr_(self) -> str:
761
761
  r"""
762
762
  TESTS::
763
763
 
@@ -777,7 +777,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
777
777
  s += " with distinguished linear extension"
778
778
  return s
779
779
 
780
- def double_irreducibles(self):
780
+ def double_irreducibles(self) -> list:
781
781
  """
782
782
  Return the list of double irreducible elements of this lattice.
783
783
 
@@ -811,7 +811,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
811
811
  return [self._vertex_to_element(e) for e in H
812
812
  if H.in_degree(e) == 1 and H.out_degree(e) == 1]
813
813
 
814
- def join_primes(self):
814
+ def join_primes(self) -> list:
815
815
  r"""
816
816
  Return the join-prime elements of the lattice.
817
817
 
@@ -848,7 +848,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
848
848
  return [self._vertex_to_element(v) for
849
849
  v in self._hasse_diagram.prime_elements()[0]]
850
850
 
851
- def meet_primes(self):
851
+ def meet_primes(self) -> list:
852
852
  r"""
853
853
  Return the meet-prime elements of the lattice.
854
854
 
@@ -885,7 +885,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
885
885
  return [self._vertex_to_element(v) for
886
886
  v in self._hasse_diagram.prime_elements()[1]]
887
887
 
888
- def neutral_elements(self):
888
+ def neutral_elements(self) -> list:
889
889
  r"""
890
890
  Return the list of neutral elements of the lattice.
891
891
 
@@ -917,7 +917,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
917
917
  t = sorted(self._hasse_diagram.neutral_elements())
918
918
  return [self._vertex_to_element(v) for v in t]
919
919
 
920
- def is_join_distributive(self, certificate=False):
920
+ def is_join_distributive(self, certificate=False) -> bool | tuple:
921
921
  """
922
922
  Return ``True`` if the lattice is join-distributive and ``False``
923
923
  otherwise.
@@ -1006,7 +1006,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1006
1006
  diamond = next(self._hasse_diagram.subgraph_search_iterator(M3, return_graphs=False))
1007
1007
  return (False, self[diamond[0]])
1008
1008
 
1009
- def is_meet_distributive(self, certificate=False):
1009
+ def is_meet_distributive(self, certificate=False) -> bool | tuple:
1010
1010
  """
1011
1011
  Return ``True`` if the lattice is meet-distributive and ``False``
1012
1012
  otherwise.
@@ -1094,7 +1094,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1094
1094
  diamond = next(self._hasse_diagram.subgraph_search_iterator(M3, return_graphs=False))
1095
1095
  return (False, self[diamond[4]])
1096
1096
 
1097
- def is_stone(self, certificate=False):
1097
+ def is_stone(self, certificate=False) -> bool | tuple:
1098
1098
  r"""
1099
1099
  Return ``True`` if the lattice is a Stone lattice, and ``False``
1100
1100
  otherwise.
@@ -1189,7 +1189,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1189
1189
 
1190
1190
  return ok
1191
1191
 
1192
- def is_distributive(self, certificate=False):
1192
+ def is_distributive(self, certificate=False) -> bool | tuple:
1193
1193
  r"""
1194
1194
  Return ``True`` if the lattice is distributive, and ``False``
1195
1195
  otherwise.
@@ -1229,7 +1229,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1229
1229
  :meth:`is_semidistributive`, :meth:`is_join_distributive`,
1230
1230
  :meth:`is_meet_distributive`, :meth:`is_subdirectly_reducible`,
1231
1231
  :meth:`is_trim`,
1232
- :meth:`is_constructible_by_doublings` (by interval doubling),
1232
+ :meth:`is_congruence_uniform`,
1233
1233
  :meth:`is_extremal`
1234
1234
 
1235
1235
  - Stronger properties: :meth:`is_stone`
@@ -1263,7 +1263,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1263
1263
  self._vertex_to_element(diamond[2]),
1264
1264
  self._vertex_to_element(diamond[3])))
1265
1265
 
1266
- def is_semidistributive(self):
1266
+ def is_semidistributive(self) -> bool:
1267
1267
  """
1268
1268
  Return ``True`` if the lattice is both join- and meet-semidistributive,
1269
1269
  and ``False`` otherwise.
@@ -1309,7 +1309,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1309
1309
  H.out_degree_sequence().count(1)) and
1310
1310
  self.is_meet_semidistributive())
1311
1311
 
1312
- def is_meet_semidistributive(self, certificate=False):
1312
+ def is_meet_semidistributive(self, certificate=False) -> bool | tuple:
1313
1313
  r"""
1314
1314
  Return ``True`` if the lattice is meet-semidistributive, and ``False``
1315
1315
  otherwise.
@@ -1401,7 +1401,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1401
1401
  return (True, None)
1402
1402
  return True
1403
1403
 
1404
- def is_join_semidistributive(self, certificate=False):
1404
+ def is_join_semidistributive(self, certificate=False) -> bool | tuple:
1405
1405
  r"""
1406
1406
  Return ``True`` if the lattice is join-semidistributive, and ``False``
1407
1407
  otherwise.
@@ -1497,7 +1497,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1497
1497
  return all(H.kappa_dual(v) is not None
1498
1498
  for v in H if H.out_degree(v) == 1)
1499
1499
 
1500
- def is_extremal(self):
1500
+ def is_extremal(self) -> bool:
1501
1501
  """
1502
1502
  Return ``True`` if the lattice is extremal, and ``False``
1503
1503
  otherwise.
@@ -1527,7 +1527,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1527
1527
  mi = len(self.meet_irreducibles())
1528
1528
  return ji == mi == self.height() - 1
1529
1529
 
1530
- def is_trim(self, certificate=False):
1530
+ def is_trim(self, certificate=False) -> bool | tuple:
1531
1531
  """
1532
1532
  Return whether a lattice is trim.
1533
1533
 
@@ -1573,10 +1573,9 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1573
1573
 
1574
1574
  if all(self.is_left_modular_element(e) for e in chain):
1575
1575
  return (True, chain) if certificate else True
1576
- else:
1577
- return (False, None) if certificate else False
1576
+ return (False, None) if certificate else False
1578
1577
 
1579
- def is_complemented(self, certificate=False):
1578
+ def is_complemented(self, certificate=False) -> bool | tuple:
1580
1579
  r"""
1581
1580
  Return ``True`` if the lattice is complemented, and
1582
1581
  ``False`` otherwise.
@@ -1627,7 +1626,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1627
1626
  return (True, None)
1628
1627
  return (False, self._vertex_to_element(e))
1629
1628
 
1630
- def is_cosectionally_complemented(self, certificate=False):
1629
+ def is_cosectionally_complemented(self, certificate=False) -> bool | tuple:
1631
1630
  """
1632
1631
  Return ``True`` if the lattice is cosectionally complemented, and
1633
1632
  ``False`` otherwise.
@@ -1703,7 +1702,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1703
1702
  return False
1704
1703
  return (True, None) if certificate else True
1705
1704
 
1706
- def is_relatively_complemented(self, certificate=False):
1705
+ def is_relatively_complemented(self, certificate=False) -> bool | tuple:
1707
1706
  """
1708
1707
  Return ``True`` if the lattice is relatively complemented, and
1709
1708
  ``False`` otherwise.
@@ -1816,7 +1815,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1816
1815
  self._vertex_to_element(e3)))
1817
1816
  return (True, None) if certificate else True
1818
1817
 
1819
- def is_sectionally_complemented(self, certificate=False):
1818
+ def is_sectionally_complemented(self, certificate=False) -> bool | tuple:
1820
1819
  """
1821
1820
  Return ``True`` if the lattice is sectionally complemented, and
1822
1821
  ``False`` otherwise.
@@ -1893,7 +1892,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1893
1892
  return False
1894
1893
  return (True, None) if certificate else True
1895
1894
 
1896
- def breadth(self, certificate=False):
1895
+ def breadth(self, certificate=False) -> int | tuple:
1897
1896
  r"""
1898
1897
  Return the breadth of the lattice.
1899
1898
 
@@ -1998,9 +1997,9 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
1998
1997
  if join(A) == j:
1999
1998
  if all(join(A[:i] + A[i + 1:]) != j for i in range(B)):
2000
1999
  if certificate:
2001
- return (B, [self._vertex_to_element(e) for e in A])
2002
- else:
2003
- return B
2000
+ return (B, [self._vertex_to_element(e)
2001
+ for e in A])
2002
+ return B
2004
2003
  raise RuntimeError("BUG: breadth() in lattices.py have an error")
2005
2004
 
2006
2005
  def complements(self, element=None):
@@ -2087,7 +2086,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2087
2086
  if self.meet(x, element) == self.bottom() and
2088
2087
  self.join(x, element) == self.top()]
2089
2088
 
2090
- def is_pseudocomplemented(self, certificate=False):
2089
+ def is_pseudocomplemented(self, certificate=False) -> bool | tuple:
2091
2090
  r"""
2092
2091
  Return ``True`` if the lattice is pseudocomplemented, and ``False``
2093
2092
  otherwise.
@@ -2154,7 +2153,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2154
2153
  return (True, None)
2155
2154
  return True
2156
2155
 
2157
- def is_join_pseudocomplemented(self, certificate=False):
2156
+ def is_join_pseudocomplemented(self, certificate=False) -> bool | tuple:
2158
2157
  """
2159
2158
  Return ``True`` if the lattice is join-pseudocomplemented, and
2160
2159
  ``False`` otherwise.
@@ -2265,7 +2264,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2265
2264
  self._hasse_diagram.skeleton()]
2266
2265
  return LatticePoset(self.subposet(elms))
2267
2266
 
2268
- def is_orthocomplemented(self, unique=False):
2267
+ def is_orthocomplemented(self, unique=False) -> bool:
2269
2268
  """
2270
2269
  Return ``True`` if the lattice admits an orthocomplementation, and
2271
2270
  ``False`` otherwise.
@@ -2324,7 +2323,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2324
2323
  return True
2325
2324
  raise AssertionError("bug in is_orthocomplemented()")
2326
2325
 
2327
- def is_atomic(self, certificate=False):
2326
+ def is_atomic(self, certificate=False) -> bool | tuple:
2328
2327
  r"""
2329
2328
  Return ``True`` if the lattice is atomic, and ``False`` otherwise.
2330
2329
 
@@ -2382,7 +2381,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2382
2381
  return (False, self._vertex_to_element(v))
2383
2382
  return (True, None)
2384
2383
 
2385
- def is_coatomic(self, certificate=False):
2384
+ def is_coatomic(self, certificate=False) -> bool | tuple:
2386
2385
  r"""
2387
2386
  Return ``True`` if the lattice is coatomic, and ``False`` otherwise.
2388
2387
 
@@ -2440,7 +2439,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2440
2439
  return (False, self._vertex_to_element(v))
2441
2440
  return (True, None)
2442
2441
 
2443
- def is_geometric(self):
2442
+ def is_geometric(self) -> bool:
2444
2443
  """
2445
2444
  Return ``True`` if the lattice is geometric, and ``False`` otherwise.
2446
2445
 
@@ -2485,7 +2484,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2485
2484
  """
2486
2485
  return self.is_atomic() and self.is_upper_semimodular()
2487
2486
 
2488
- def is_planar(self):
2487
+ def is_planar(self) -> bool:
2489
2488
  r"""
2490
2489
  Return ``True`` if the lattice is *upward* planar, and ``False``
2491
2490
  otherwise.
@@ -2553,7 +2552,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2553
2552
  g.add_edge(0, self.cardinality() - 1)
2554
2553
  return g.is_planar()
2555
2554
 
2556
- def is_modular(self, L=None, certificate=False):
2555
+ def is_modular(self, L=None, certificate=False) -> bool | tuple:
2557
2556
  r"""
2558
2557
  Return ``True`` if the lattice is modular and ``False`` otherwise.
2559
2558
 
@@ -2658,7 +2657,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2658
2657
  return (True, None)
2659
2658
  return True
2660
2659
 
2661
- def is_modular_element(self, x):
2660
+ def is_modular_element(self, x) -> bool:
2662
2661
  r"""
2663
2662
  Return ``True`` if ``x`` is a modular element and ``False`` otherwise.
2664
2663
 
@@ -2690,7 +2689,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2690
2689
  """
2691
2690
  return self.is_modular([x])
2692
2691
 
2693
- def is_left_modular_element(self, x):
2692
+ def is_left_modular_element(self, x) -> bool:
2694
2693
  r"""
2695
2694
  Return ``True`` if ``x`` is a left modular element
2696
2695
  and ``False`` otherwise.
@@ -2723,7 +2722,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2723
2722
  self.join(y, self.meet(x, z))
2724
2723
  for y, z in self.cover_relations_iterator())
2725
2724
 
2726
- def is_upper_semimodular(self, certificate=False):
2725
+ def is_upper_semimodular(self, certificate=False) -> bool | tuple:
2727
2726
  r"""
2728
2727
  Return ``True`` if the lattice is upper semimodular and
2729
2728
  ``False`` otherwise.
@@ -2783,7 +2782,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2783
2782
  self._vertex_to_element(nonmodular[1])))
2784
2783
  return False
2785
2784
 
2786
- def is_lower_semimodular(self, certificate=False):
2785
+ def is_lower_semimodular(self, certificate=False) -> bool | tuple:
2787
2786
  r"""
2788
2787
  Return ``True`` if the lattice is lower semimodular and
2789
2788
  ``False`` otherwise.
@@ -2838,7 +2837,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2838
2837
  self._vertex_to_element(nonmodular[1])))
2839
2838
  return False
2840
2839
 
2841
- def is_supersolvable(self, certificate=False):
2840
+ def is_supersolvable(self, certificate=False) -> bool | tuple:
2842
2841
  r"""
2843
2842
  Return ``True`` if the lattice is supersolvable, and
2844
2843
  ``False`` otherwise.
@@ -2916,7 +2915,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
2916
2915
  next_ = [H.neighbor_in_iterator(cur)]
2917
2916
 
2918
2917
  @cached_function
2919
- def is_modular_elt(a):
2918
+ def is_modular_elt(a) -> bool:
2920
2919
  return all(H._rank[a] + H._rank[b] ==
2921
2920
  H._rank[mt[a, b]] + H._rank[jn[a, b]]
2922
2921
  for b in range(n))
@@ -3081,8 +3080,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3081
3080
  if self.cardinality() <= 2:
3082
3081
  if not elements_only:
3083
3082
  return [self]
3084
- else:
3085
- return []
3083
+ return []
3086
3084
  if elements_only:
3087
3085
  return [self[e] for e in
3088
3086
  self._hasse_diagram.vertical_decomposition(return_list=True)]
@@ -3095,7 +3093,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3095
3093
  elms[i + 1] + 1)]))
3096
3094
  for i in range(n - 1)]
3097
3095
 
3098
- def is_vertically_decomposable(self, certificate=False):
3096
+ def is_vertically_decomposable(self, certificate=False) -> bool | tuple:
3099
3097
  r"""
3100
3098
  Return ``True`` if the lattice is vertically decomposable, and
3101
3099
  ``False`` otherwise.
@@ -3189,7 +3187,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3189
3187
 
3190
3188
  return LatticePoset(self.subposet(current_set))
3191
3189
 
3192
- def is_sublattice(self, other):
3190
+ def is_sublattice(self, other) -> bool:
3193
3191
  """
3194
3192
  Return ``True`` if the lattice is a sublattice of ``other``,
3195
3193
  and ``False`` otherwise.
@@ -3687,7 +3685,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3687
3685
  comps = self.complements()
3688
3686
  return self.sublattice([e for e in neutrals if e in comps])
3689
3687
 
3690
- def is_dismantlable(self, certificate=False):
3688
+ def is_dismantlable(self, certificate=False) -> bool | tuple:
3691
3689
  r"""
3692
3690
  Return ``True`` if the lattice is dismantlable, and ``False``
3693
3691
  otherwise.
@@ -3802,7 +3800,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3802
3800
  return True
3803
3801
  return (True, [self[e] for e in cert])
3804
3802
 
3805
- def is_interval_dismantlable(self, certificate=False):
3803
+ def is_interval_dismantlable(self, certificate=False) -> bool | tuple:
3806
3804
  """
3807
3805
  Return ``True`` if the lattice is interval dismantlable, and
3808
3806
  ``False`` otherwise.
@@ -3915,7 +3913,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3915
3913
  return result if certificate else True
3916
3914
  return (False, minimal_non_int_dismant(self)) if certificate else False
3917
3915
 
3918
- def is_sublattice_dismantlable(self):
3916
+ def is_sublattice_dismantlable(self) -> bool:
3919
3917
  """
3920
3918
  Return ``True`` if the lattice is sublattice dismantlable, and
3921
3919
  ``False`` otherwise.
@@ -3988,7 +3986,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
3988
3986
 
3989
3987
  return False
3990
3988
 
3991
- def is_subdirectly_reducible(self, certificate=False):
3989
+ def is_subdirectly_reducible(self, certificate=False) -> bool | tuple:
3992
3990
  r"""
3993
3991
  Return ``True`` if the lattice is subdirectly reducible.
3994
3992
 
@@ -4371,7 +4369,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
4371
4369
  """
4372
4370
  return self.is_constructible_by_doublings(type="interval")
4373
4371
 
4374
- def is_isoform(self, certificate=False):
4372
+ def is_isoform(self, certificate=False) -> bool | tuple:
4375
4373
  """
4376
4374
  Return ``True`` if the lattice is isoform and ``False`` otherwise.
4377
4375
 
@@ -4446,7 +4444,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
4446
4444
  return False
4447
4445
  return ok
4448
4446
 
4449
- def is_uniform(self, certificate=False):
4447
+ def is_uniform(self, certificate=False) -> bool | tuple:
4450
4448
  """
4451
4449
  Return ``True`` if the lattice is uniform and ``False`` otherwise.
4452
4450
 
@@ -4526,7 +4524,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
4526
4524
  return False
4527
4525
  return ok
4528
4526
 
4529
- def is_regular(self, certificate=False):
4527
+ def is_regular(self, certificate=False) -> bool | tuple:
4530
4528
  """
4531
4529
  Return ``True`` if the lattice is regular and ``False`` otherwise.
4532
4530
 
@@ -4594,7 +4592,7 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
4594
4592
  return False
4595
4593
  return ok
4596
4594
 
4597
- def is_simple(self, certificate=False):
4595
+ def is_simple(self, certificate=False) -> bool | tuple:
4598
4596
  """
4599
4597
  Return ``True`` if the lattice is simple and ``False`` otherwise.
4600
4598
 
@@ -4881,9 +4879,9 @@ class FiniteLatticePoset(FiniteMeetSemilattice, FiniteJoinSemilattice):
4881
4879
  parts_H = [sorted([self._element_to_vertex(e) for e in part]) for
4882
4880
  part in congruence]
4883
4881
  minimal_vertices = [part[0] for part in parts_H]
4884
- H = self._hasse_diagram.transitive_closure().subgraph(minimal_vertices).transitive_reduction()
4882
+ H = self._hasse_diagram.transitive_closure().subgraph(minimal_vertices).transitive_reduction(immutable=False)
4885
4883
  if labels == 'integer':
4886
- H.relabel(list(range(len(minimal_vertices))))
4884
+ H.relabel()
4887
4885
  return LatticePoset(H)
4888
4886
  part_dict = {m[0]: [self._vertex_to_element(x) for x in m] for m
4889
4887
  in parts_H}
@@ -121,7 +121,7 @@ class LinearExtensionOfPoset(ClonableArray,
121
121
  return linear_extension
122
122
  return LinearExtensionsOfPoset(poset)(linear_extension)
123
123
 
124
- def check(self):
124
+ def check(self) -> None:
125
125
  r"""
126
126
  Check whether ``self`` is indeed a linear extension of the underlying poset.
127
127
 
@@ -152,7 +152,7 @@ class LinearExtensionOfPoset(ClonableArray,
152
152
  """
153
153
  return self.parent().poset()
154
154
 
155
- def _latex_(self):
155
+ def _latex_(self) -> str:
156
156
  r"""
157
157
  Return the latex string for ``self``.
158
158
 
@@ -208,12 +208,12 @@ class LinearExtensionOfPoset(ClonableArray,
208
208
  True
209
209
  """
210
210
  P = self.parent().poset()
211
- old = [P.unwrap(x) for x in self]
211
+ old = (P.unwrap(x) for x in self)
212
212
  new = [P.unwrap(x) for x in P]
213
213
  relabelling = dict(zip(old, new))
214
214
  return P.relabel(relabelling).with_linear_extension(new)
215
215
 
216
- def is_greedy(self):
216
+ def is_greedy(self) -> bool:
217
217
  r"""
218
218
  Return ``True`` if the linear extension is greedy.
219
219
 
@@ -247,7 +247,7 @@ class LinearExtensionOfPoset(ClonableArray,
247
247
  return False
248
248
  return True
249
249
 
250
- def is_supergreedy(self):
250
+ def is_supergreedy(self) -> bool:
251
251
  r"""
252
252
  Return ``True`` if the linear extension is supergreedy.
253
253
 
@@ -421,7 +421,7 @@ class LinearExtensionOfPoset(ClonableArray,
421
421
  self = self.tau(j)
422
422
  return self
423
423
 
424
- def jump_count(self):
424
+ def jump_count(self) -> int:
425
425
  r"""
426
426
  Return the number of jumps in the linear extension.
427
427
 
@@ -541,7 +541,7 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
541
541
  facade = (list,)
542
542
  Parent.__init__(self, category=FiniteEnumeratedSets(), facade=facade)
543
543
 
544
- def _repr_(self):
544
+ def _repr_(self) -> str:
545
545
  """
546
546
  TESTS::
547
547
 
@@ -700,7 +700,7 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
700
700
  return (isinstance(obj, (list, tuple)) and
701
701
  self.poset().is_linear_extension(obj))
702
702
 
703
- def markov_chain_digraph(self, action='promotion', labeling='identity'):
703
+ def markov_chain_digraph(self, action='promotion', labeling='identity') -> DiGraph:
704
704
  r"""
705
705
  Return the digraph of the action of generalized promotion or tau on ``self``.
706
706
 
@@ -737,7 +737,6 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
737
737
  ([2, 1, 3, 4], [1, 2, 4, 3], 1), ([2, 1, 3, 4], [2, 1, 3, 4], 4), ([2, 1, 3, 4], [2, 1, 4, 3], 2),
738
738
  ([2, 1, 3, 4], [2, 1, 4, 3], 3), ([2, 1, 4, 3], [1, 4, 2, 3], 1), ([2, 1, 4, 3], [2, 1, 3, 4], 2),
739
739
  ([2, 1, 4, 3], [2, 1, 3, 4], 3), ([2, 1, 4, 3], [2, 1, 4, 3], 4)]
740
-
741
740
  sage: G = L.markov_chain_digraph(labeling='source')
742
741
  sage: G.vertices(sort=True, key=repr)
743
742
  [[1, 2, 3, 4], [1, 2, 4, 3], [1, 4, 2, 3], [2, 1, 3, 4], [2, 1, 4, 3]]
@@ -899,11 +898,10 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
899
898
  lst = list(lst)
900
899
  if not isinstance(lst, (list, tuple)):
901
900
  raise TypeError("input should be a list or tuple")
902
- lst = [self._poset(_) for _ in lst]
901
+ lst = [self._poset(e) for e in lst]
903
902
  if self._is_facade:
904
903
  return lst
905
- else:
906
- return self.element_class(self, lst, check)
904
+ return self.element_class(self, lst, check)
907
905
 
908
906
  Element = LinearExtensionOfPoset
909
907
 
@@ -114,7 +114,7 @@ class MoebiusAlgebra(Parent, UniqueRepresentation):
114
114
  self._category = cat
115
115
  Parent.__init__(self, base=R, category=self._category.WithRealizations())
116
116
 
117
- def _repr_(self):
117
+ def _repr_(self) -> str:
118
118
  """
119
119
  Return a string representation of ``self``.
120
120
 
@@ -412,7 +412,7 @@ class QuantumMoebiusAlgebra(Parent, UniqueRepresentation):
412
412
  self._category = cat
413
413
  Parent.__init__(self, base=R, category=self._category.WithRealizations())
414
414
 
415
- def _repr_(self):
415
+ def _repr_(self) -> str:
416
416
  """
417
417
  Return a string representation of ``self``.
418
418
 
@@ -694,7 +694,7 @@ class MoebiusAlgebraBases(Category_realization_of_parent):
694
694
  sage: M.E() in bases
695
695
  True
696
696
  """
697
- def _repr_(self):
697
+ def _repr_(self) -> str:
698
698
  r"""
699
699
  Return the representation of ``self``.
700
700
 
@@ -725,7 +725,7 @@ class MoebiusAlgebraBases(Category_realization_of_parent):
725
725
  return [self.base()._category, Realizations(self.base())]
726
726
 
727
727
  class ParentMethods:
728
- def _repr_(self):
728
+ def _repr_(self) -> str:
729
729
  """
730
730
  Text representation of this basis of a Möbius algebra.
731
731