diff --git a/src/sage/combinat/affine_permutation.py b/src/sage/combinat/affine_permutation.py index 17279fee0e8..d0ce08e3e83 100644 --- a/src/sage/combinat/affine_permutation.py +++ b/src/sage/combinat/affine_permutation.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.groups r""" Affine Permutations """ diff --git a/src/sage/combinat/alternating_sign_matrix.py b/src/sage/combinat/alternating_sign_matrix.py index 80d4ab301b7..a42b7a2898c 100644 --- a/src/sage/combinat/alternating_sign_matrix.py +++ b/src/sage/combinat/alternating_sign_matrix.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Alternating Sign Matrices diff --git a/src/sage/combinat/bijectionist.py b/src/sage/combinat/bijectionist.py index 68d1f322e9f..00053209d4e 100644 --- a/src/sage/combinat/bijectionist.py +++ b/src/sage/combinat/bijectionist.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.numerical.mip r""" A bijectionist's toolkit diff --git a/src/sage/combinat/binary_recurrence_sequences.py b/src/sage/combinat/binary_recurrence_sequences.py index 9527c512360..04223d9975a 100644 --- a/src/sage/combinat/binary_recurrence_sequences.py +++ b/src/sage/combinat/binary_recurrence_sequences.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Binary Recurrence Sequences diff --git a/src/sage/combinat/blob_algebra.py b/src/sage/combinat/blob_algebra.py index 657c70a5c0e..595063a69fd 100644 --- a/src/sage/combinat/blob_algebra.py +++ b/src/sage/combinat/blob_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Blob Algebras diff --git a/src/sage/combinat/chas/fsym.py b/src/sage/combinat/chas/fsym.py index a2dfd12f621..f1c149c66f1 100644 --- a/src/sage/combinat/chas/fsym.py +++ b/src/sage/combinat/chas/fsym.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Poirier-Reutenauer Hopf algebra of standard tableaux diff --git a/src/sage/combinat/chas/wqsym.py b/src/sage/combinat/chas/wqsym.py index 99659ab154a..57b90761c88 100644 --- a/src/sage/combinat/chas/wqsym.py +++ b/src/sage/combinat/chas/wqsym.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Word Quasi-symmetric functions diff --git a/src/sage/combinat/cluster_complex.py b/src/sage/combinat/cluster_complex.py index e263d983887..a1f7489f1ad 100644 --- a/src/sage/combinat/cluster_complex.py +++ b/src/sage/combinat/cluster_complex.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.graphs r""" Cluster complex (or generalized dual associahedron) diff --git a/src/sage/combinat/constellation.py b/src/sage/combinat/constellation.py index cbefe06054d..e80026ecf85 100644 --- a/src/sage/combinat/constellation.py +++ b/src/sage/combinat/constellation.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.groups r""" Constellations diff --git a/src/sage/combinat/crystals/affine.py b/src/sage/combinat/crystals/affine.py index c33fe853152..186d2ea373e 100644 --- a/src/sage/combinat/crystals/affine.py +++ b/src/sage/combinat/crystals/affine.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Affine Crystals """ diff --git a/src/sage/combinat/crystals/affine_factorization.py b/src/sage/combinat/crystals/affine_factorization.py index f6bbf42966f..b1d820032af 100644 --- a/src/sage/combinat/crystals/affine_factorization.py +++ b/src/sage/combinat/crystals/affine_factorization.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Affine factorization crystal of type `A` """ diff --git a/src/sage/combinat/crystals/affinization.py b/src/sage/combinat/crystals/affinization.py index 2a58d8ab609..d849e407c3f 100644 --- a/src/sage/combinat/crystals/affinization.py +++ b/src/sage/combinat/crystals/affinization.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Affinization Crystals """ diff --git a/src/sage/combinat/crystals/alcove_path.py b/src/sage/combinat/crystals/alcove_path.py index aa5dc56d9ca..2ae58703362 100644 --- a/src/sage/combinat/crystals/alcove_path.py +++ b/src/sage/combinat/crystals/alcove_path.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Alcove paths diff --git a/src/sage/combinat/crystals/bkk_crystals.py b/src/sage/combinat/crystals/bkk_crystals.py index 15e795ca484..b3658fd28a4 100644 --- a/src/sage/combinat/crystals/bkk_crystals.py +++ b/src/sage/combinat/crystals/bkk_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Benkart-Kang-Kashiwara crystals for the general-linear Lie superalgebra """ diff --git a/src/sage/combinat/crystals/crystals.py b/src/sage/combinat/crystals/crystals.py index dbc2e9a211f..b68469ce8ba 100644 --- a/src/sage/combinat/crystals/crystals.py +++ b/src/sage/combinat/crystals/crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" An introduction to crystals =========================== diff --git a/src/sage/combinat/crystals/direct_sum.py b/src/sage/combinat/crystals/direct_sum.py index e66ea6e9ef5..f94570091d8 100644 --- a/src/sage/combinat/crystals/direct_sum.py +++ b/src/sage/combinat/crystals/direct_sum.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Direct Sum of Crystals """ diff --git a/src/sage/combinat/crystals/elementary_crystals.py b/src/sage/combinat/crystals/elementary_crystals.py index 2aa68d0279e..c89dd7504fd 100644 --- a/src/sage/combinat/crystals/elementary_crystals.py +++ b/src/sage/combinat/crystals/elementary_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Elementary Crystals diff --git a/src/sage/combinat/crystals/fast_crystals.py b/src/sage/combinat/crystals/fast_crystals.py index 8a33913269d..aebc499e9fb 100644 --- a/src/sage/combinat/crystals/fast_crystals.py +++ b/src/sage/combinat/crystals/fast_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Fast Rank Two Crystals """ diff --git a/src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py b/src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py index b4fbcff59a3..51a04179364 100644 --- a/src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py +++ b/src/sage/combinat/crystals/fully_commutative_stable_grothendieck.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Fully commutative stable Grothendieck crystal diff --git a/src/sage/combinat/crystals/generalized_young_walls.py b/src/sage/combinat/crystals/generalized_young_walls.py index 59cd7e92050..36f6c259942 100644 --- a/src/sage/combinat/crystals/generalized_young_walls.py +++ b/src/sage/combinat/crystals/generalized_young_walls.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Crystals of Generalized Young Walls diff --git a/src/sage/combinat/crystals/highest_weight_crystals.py b/src/sage/combinat/crystals/highest_weight_crystals.py index 1b1d7f315e8..96d7377c029 100644 --- a/src/sage/combinat/crystals/highest_weight_crystals.py +++ b/src/sage/combinat/crystals/highest_weight_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Highest weight crystals """ diff --git a/src/sage/combinat/crystals/induced_structure.py b/src/sage/combinat/crystals/induced_structure.py index 2920fb67b7c..95ed85bf5f8 100644 --- a/src/sage/combinat/crystals/induced_structure.py +++ b/src/sage/combinat/crystals/induced_structure.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Induced Crystals diff --git a/src/sage/combinat/crystals/infinity_crystals.py b/src/sage/combinat/crystals/infinity_crystals.py index 32536d9de60..6219da38391 100644 --- a/src/sage/combinat/crystals/infinity_crystals.py +++ b/src/sage/combinat/crystals/infinity_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" `\mathcal{B}(\infty)` Crystals of Tableaux in Nonexceptional Types and `G_2` diff --git a/src/sage/combinat/crystals/kac_modules.py b/src/sage/combinat/crystals/kac_modules.py index d9da3fd8bff..79d753ac9ae 100644 --- a/src/sage/combinat/crystals/kac_modules.py +++ b/src/sage/combinat/crystals/kac_modules.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Crystals of Kac modules of the general-linear Lie superalgebra """ diff --git a/src/sage/combinat/crystals/kirillov_reshetikhin.py b/src/sage/combinat/crystals/kirillov_reshetikhin.py index 10de248f868..0856d337fb6 100644 --- a/src/sage/combinat/crystals/kirillov_reshetikhin.py +++ b/src/sage/combinat/crystals/kirillov_reshetikhin.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Kirillov-Reshetikhin Crystals """ diff --git a/src/sage/combinat/crystals/kyoto_path_model.py b/src/sage/combinat/crystals/kyoto_path_model.py index ff4c69e9ff9..e7ae0b47275 100644 --- a/src/sage/combinat/crystals/kyoto_path_model.py +++ b/src/sage/combinat/crystals/kyoto_path_model.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Kyoto Path Model for Affine Highest Weight Crystals """ diff --git a/src/sage/combinat/crystals/letters.pyx b/src/sage/combinat/crystals/letters.pyx index 921be80c434..d204a979563 100644 --- a/src/sage/combinat/crystals/letters.pyx +++ b/src/sage/combinat/crystals/letters.pyx @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Crystals of letters """ diff --git a/src/sage/combinat/crystals/littelmann_path.py b/src/sage/combinat/crystals/littelmann_path.py index c384a818e56..a90a61cb4c9 100644 --- a/src/sage/combinat/crystals/littelmann_path.py +++ b/src/sage/combinat/crystals/littelmann_path.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Littelmann paths diff --git a/src/sage/combinat/crystals/monomial_crystals.py b/src/sage/combinat/crystals/monomial_crystals.py index 38ae061355f..7ba4b52bb51 100644 --- a/src/sage/combinat/crystals/monomial_crystals.py +++ b/src/sage/combinat/crystals/monomial_crystals.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Crystals of Modified Nakajima Monomials diff --git a/src/sage/combinat/crystals/multisegments.py b/src/sage/combinat/crystals/multisegments.py index a3d0d661015..6f63d4562a3 100644 --- a/src/sage/combinat/crystals/multisegments.py +++ b/src/sage/combinat/crystals/multisegments.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Crystal of Bernstein-Zelevinsky Multisegments """ diff --git a/src/sage/combinat/crystals/mv_polytopes.py b/src/sage/combinat/crystals/mv_polytopes.py index cd6a4497d8e..67967f88bd0 100644 --- a/src/sage/combinat/crystals/mv_polytopes.py +++ b/src/sage/combinat/crystals/mv_polytopes.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Crystal Of Mirković-Vilonen (MV) Polytopes diff --git a/src/sage/combinat/crystals/pbw_crystal.py b/src/sage/combinat/crystals/pbw_crystal.py index df359333f6d..9859438ae58 100644 --- a/src/sage/combinat/crystals/pbw_crystal.py +++ b/src/sage/combinat/crystals/pbw_crystal.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" `\mathcal{B}(\infty)` Crystal Of PBW Monomials diff --git a/src/sage/combinat/crystals/pbw_datum.pyx b/src/sage/combinat/crystals/pbw_datum.pyx index dd27d91294a..2adcb09d902 100644 --- a/src/sage/combinat/crystals/pbw_datum.pyx +++ b/src/sage/combinat/crystals/pbw_datum.pyx @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" PBW Data diff --git a/src/sage/combinat/crystals/polyhedral_realization.py b/src/sage/combinat/crystals/polyhedral_realization.py index f4f20fe84f7..c4193b44655 100644 --- a/src/sage/combinat/crystals/polyhedral_realization.py +++ b/src/sage/combinat/crystals/polyhedral_realization.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Polyhedral Realization of `B(\infty)` """ diff --git a/src/sage/combinat/crystals/spins.pyx b/src/sage/combinat/crystals/spins.pyx index 0798a534077..7548b7b695e 100644 --- a/src/sage/combinat/crystals/spins.pyx +++ b/src/sage/combinat/crystals/spins.pyx @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Spin Crystals diff --git a/src/sage/combinat/crystals/star_crystal.py b/src/sage/combinat/crystals/star_crystal.py index 2b4ac9c90a8..02427149ed4 100644 --- a/src/sage/combinat/crystals/star_crystal.py +++ b/src/sage/combinat/crystals/star_crystal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Star-Crystal Structure On `B(\infty)` diff --git a/src/sage/combinat/crystals/subcrystal.py b/src/sage/combinat/crystals/subcrystal.py index b1221b51e88..e712abd38c8 100644 --- a/src/sage/combinat/crystals/subcrystal.py +++ b/src/sage/combinat/crystals/subcrystal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Subcrystals diff --git a/src/sage/combinat/crystals/tensor_product.py b/src/sage/combinat/crystals/tensor_product.py index bfe1801454d..a1b94ccf541 100644 --- a/src/sage/combinat/crystals/tensor_product.py +++ b/src/sage/combinat/crystals/tensor_product.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Tensor Products of Crystals diff --git a/src/sage/combinat/crystals/tensor_product_element.pyx b/src/sage/combinat/crystals/tensor_product_element.pyx index a95d2060b4b..bafdb5e175a 100644 --- a/src/sage/combinat/crystals/tensor_product_element.pyx +++ b/src/sage/combinat/crystals/tensor_product_element.pyx @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules """ Tensor Products of Crystal Elements diff --git a/src/sage/combinat/crystals/virtual_crystal.py b/src/sage/combinat/crystals/virtual_crystal.py index f14bf59dd42..a4cdc8b4ee8 100644 --- a/src/sage/combinat/crystals/virtual_crystal.py +++ b/src/sage/combinat/crystals/virtual_crystal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Virtual Crystals diff --git a/src/sage/combinat/descent_algebra.py b/src/sage/combinat/descent_algebra.py index 8945c697c1e..3468d80b4b7 100644 --- a/src/sage/combinat/descent_algebra.py +++ b/src/sage/combinat/descent_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Descent Algebras diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index 019c11dbf65..7363fa05f90 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -236,7 +236,7 @@ def balanced_incomplete_block_design(v, k, lambd=1, existence=False, use_LJCR=Fa (10,4,2)-Balanced Incomplete Block Design sage: designs.balanced_incomplete_block_design(50,25,24) # needs sage.schemes (50,25,24)-Balanced Incomplete Block Design - sage: designs.balanced_incomplete_block_design(29,15,15) # needs sage.libs.pari + sage: designs.balanced_incomplete_block_design(29,15,15) # needs sage.libs.pari sage.schemes (29,15,15)-Balanced Incomplete Block Design """ # Trivial BIBD @@ -1125,7 +1125,7 @@ def v_5_1_BIBD(v, check=True): sage: from sage.combinat.designs.bibd import v_5_1_BIBD sage: i = 0 - sage: while i<200: # needs sage.libs.pari + sage: while i<200: # needs sage.libs.pari sage.schemes ....: i += 20 ....: _ = v_5_1_BIBD(i+1) ....: _ = v_5_1_BIBD(i+5) diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index 17720d6ca92..86c3b1383ee 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -122,8 +122,8 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame sage: are_hyperplanes_in_projective_geometry_parameters(40, 13, 4, ....: return_parameters=True) (True, (3, 3)) - sage: PG = designs.ProjectiveGeometryDesign(3, 2, GF(3)) - sage: PG.is_t_design(return_parameters=True) + sage: PG = designs.ProjectiveGeometryDesign(3, 2, GF(3)) # needs sage.combinat + sage: PG.is_t_design(return_parameters=True) # needs sage.combinat (True, (2, 40, 13, 4)) sage: are_hyperplanes_in_projective_geometry_parameters(15, 3, 1) @@ -217,13 +217,13 @@ def ProjectiveGeometryDesign(n, d, F, algorithm=None, point_coordinates=True, ch The set of `d`-dimensional subspaces in a `n`-dimensional projective space forms `2`-designs (or balanced incomplete block designs):: - sage: PG = designs.ProjectiveGeometryDesign(4, 2, GF(2)); PG + sage: PG = designs.ProjectiveGeometryDesign(4, 2, GF(2)); PG # needs sage.combinat Incidence structure with 31 points and 155 blocks - sage: PG.is_t_design(return_parameters=True) + sage: PG.is_t_design(return_parameters=True) # needs sage.combinat (True, (2, 31, 7, 7)) - sage: PG = designs.ProjectiveGeometryDesign(3, 1, GF(4)) - sage: PG.is_t_design(return_parameters=True) + sage: PG = designs.ProjectiveGeometryDesign(3, 1, GF(4)) # needs sage.combinat + sage: PG.is_t_design(return_parameters=True) # needs sage.combinat (True, (2, 85, 5, 1)) Check with ``F`` being a prime power:: @@ -707,6 +707,7 @@ def projective_plane(n, check=True, existence=False): EXAMPLES:: + sage: # needs sage.schemes sage: designs.projective_plane(2) (7,3,1)-Balanced Incomplete Block Design sage: designs.projective_plane(3) @@ -737,6 +738,7 @@ def projective_plane(n, check=True, existence=False): TESTS:: + sage: # needs sage.schemes sage: designs.projective_plane(2197, existence=True) True sage: designs.projective_plane(6, existence=True) @@ -816,6 +818,7 @@ def AffineGeometryDesign(n, d, F, point_coordinates=True, check=True): EXAMPLES:: + sage: # needs sage.combinat sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) sage: BD.is_t_design(return_parameters=True) (True, (2, 8, 2, 1)) @@ -934,12 +937,13 @@ def WittDesign(n): EXAMPLES:: - sage: BD = designs.WittDesign(9) # optional - gap_package_design - sage: BD.is_t_design(return_parameters=True) # optional - gap_package_design + sage: # optional - gap_package_design + sage: BD = designs.WittDesign(9) + sage: BD.is_t_design(return_parameters=True) (True, (2, 9, 3, 1)) - sage: BD # optional - gap_package_design + sage: BD Incidence structure with 9 points and 12 blocks - sage: print(BD) # optional - gap_package_design + sage: print(BD) Incidence structure with 9 points and 12 blocks """ libgap.load_package("design") @@ -957,16 +961,18 @@ def HadamardDesign(n): EXAMPLES:: - sage: designs.HadamardDesign(7) # needs sage.modules + sage: # needs sage.combinat sage.modules + sage: designs.HadamardDesign(7) Incidence structure with 7 points and 7 blocks - sage: print(designs.HadamardDesign(7)) # needs sage.modules + sage: print(designs.HadamardDesign(7)) Incidence structure with 7 points and 7 blocks For example, the Hadamard 2-design with `n = 11` is a design whose parameters are `2-(11, 5, 2)`. We verify that `NJ = 5J` for this design. :: - sage: D = designs.HadamardDesign(11); N = D.incidence_matrix() # needs sage.modules - sage: J = matrix(ZZ, 11, 11, [1]*11*11); N*J # needs sage.modules + sage: # needs sage.combinat sage.modules + sage: D = designs.HadamardDesign(11); N = D.incidence_matrix() + sage: J = matrix(ZZ, 11, 11, [1]*11*11); N*J [5 5 5 5 5 5 5 5 5 5 5] [5 5 5 5 5 5 5 5 5 5 5] [5 5 5 5 5 5 5 5 5 5 5] @@ -1010,7 +1016,8 @@ def Hadamard3Design(n): EXAMPLES:: - sage: designs.Hadamard3Design(12) # needs sage.modules + sage: # needs sage.combinat sage.modules + sage: designs.Hadamard3Design(12) Incidence structure with 12 points and 22 blocks We verify that any two blocks of the Hadamard `3`-design `3-(8, 4, 1)` @@ -1020,9 +1027,10 @@ def Hadamard3Design(n): :: - sage: D = designs.Hadamard3Design(8) # needs sage.modules - sage: N = D.incidence_matrix() # needs sage.modules - sage: N.transpose()*N # needs sage.modules + sage: # needs sage.combinat sage.modules + sage: D = designs.Hadamard3Design(8) + sage: N = D.incidence_matrix() + sage: N.transpose()*N [4 2 2 2 2 2 2 2 2 2 2 2 2 0] [2 4 2 2 2 2 2 2 2 2 2 2 0 2] [2 2 4 2 2 2 2 2 2 2 2 0 2 2] diff --git a/src/sage/combinat/designs/database.py b/src/sage/combinat/designs/database.py index d06578ccc22..b751df0a8eb 100644 --- a/src/sage/combinat/designs/database.py +++ b/src/sage/combinat/designs/database.py @@ -1466,8 +1466,8 @@ def OA_17_560(): sage: from sage.combinat.designs.designs_pyx import is_orthogonal_array sage: from sage.combinat.designs.database import OA_17_560 - sage: OA = OA_17_560() # needs sage.rings.finite_rings - sage: is_orthogonal_array(OA,17,560,2) # needs sage.rings.finite_rings + sage: OA = OA_17_560() # needs sage.rings.finite_rings sage.schemes + sage: is_orthogonal_array(OA,17,560,2) # needs sage.rings.finite_rings sage.schemes True The design is available from the general constructor:: @@ -3846,13 +3846,13 @@ def DM_57_8_1(): sage: from sage.combinat.designs.designs_pyx import is_difference_matrix sage: from sage.combinat.designs.database import DM_57_8_1 - sage: G,M = DM_57_8_1() # needs sage.rings.finite_rings - sage: is_difference_matrix(M,G,8,1) # needs sage.rings.finite_rings + sage: G,M = DM_57_8_1() # needs sage.rings.finite_rings sage.schemes + sage: is_difference_matrix(M,G,8,1) # needs sage.rings.finite_rings sage.schemes True Can be obtained from the constructor:: - sage: _ = designs.difference_matrix(57,8) # needs sage.rings.finite_rings + sage: _ = designs.difference_matrix(57,8) # needs sage.rings.finite_rings sage.schemes """ M = orthogonal_array(8,8) M = [R for R in M if any(x != R[0] for x in R)] # removing the 0..0, 1..1, 7..7 rows. diff --git a/src/sage/combinat/designs/group_divisible_designs.py b/src/sage/combinat/designs/group_divisible_designs.py index e1d90155920..3f3522d2018 100644 --- a/src/sage/combinat/designs/group_divisible_designs.py +++ b/src/sage/combinat/designs/group_divisible_designs.py @@ -257,6 +257,7 @@ class GroupDivisibleDesign(IncidenceStructure): With unspecified groups:: + sage: # needs sage.schemes sage: D = designs.transversal_design(4,3).relabel(list('abcdefghiklm'),inplace=False).blocks() sage: GDD = GroupDivisibleDesign('abcdefghiklm',None,D) sage: sorted(GDD.groups()) @@ -321,8 +322,9 @@ def groups(self): Non-integer ground set:: - sage: TD=designs.transversal_design(5,5) - sage: TD.relabel({i:chr(97+i) for i in range(25)}) + sage: # needs sage.schemes + sage: TD = designs.transversal_design(5,5) + sage: TD.relabel({i: chr(97+i) for i in range(25)}) sage: TD.groups() [['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'j'], diff --git a/src/sage/combinat/designs/incidence_structures.py b/src/sage/combinat/designs/incidence_structures.py index e2dc0a17278..46aada66a6e 100644 --- a/src/sage/combinat/designs/incidence_structures.py +++ b/src/sage/combinat/designs/incidence_structures.py @@ -357,18 +357,18 @@ def __contains__(self, block): sage: str="I had a dream of a time when a 3-lines patch does not kill one hour" sage: sets = Subsets(str.split(), 4) - sage: IS = IncidenceStructure(sets) # a complete 4-uniform hypergraph + sage: IS = IncidenceStructure(sets) # a complete 4-uniform hypergraph sage: ["I", "dream", "of", "one"] in IS True sage: ["does", "patch", "kill", "dream"] in IS True sage: ["Am", "I", "finally", "done ?"] in IS False - sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), # needs sage.rings.finite_rings + sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), # needs sage.combinat ....: point_coordinates=False) - sage: [3,8,7] in IS # needs sage.rings.finite_rings + sage: [3,8,7] in IS # needs sage.combinat True - sage: [3,8,9] in IS + sage: [3,8,9] in IS # needs sage.combinat False """ try: @@ -1513,10 +1513,10 @@ def is_t_design(self, t=None, v=None, k=None, l=None, return_parameters=False): 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) False - sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) # needs sage.rings.finite_rings - sage: BD.is_t_design(1) + sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) # needs sage.combinat + sage: BD.is_t_design(1) # needs sage.combinat True - sage: BD.is_t_design(2) + sage: BD.is_t_design(2) # needs sage.combinat True Steiner triple and quadruple systems are other names for `2-(v,3,1)` and @@ -1538,13 +1538,14 @@ def is_t_design(self, t=None, v=None, k=None, l=None, return_parameters=False): Some examples of Witt designs that need the gap database:: - sage: BD = designs.WittDesign(9) # optional - gap_package_design - sage: BD.is_t_design(2,9,3,1) # optional - gap_package_design + sage: # optional - gap_package_design + sage: BD = designs.WittDesign(9) + sage: BD.is_t_design(2,9,3,1) True - sage: W12 = designs.WittDesign(12) # optional - gap_package_design - sage: W12.is_t_design(5,12,6,1) # optional - gap_package_design + sage: W12 = designs.WittDesign(12) + sage: W12.is_t_design(5,12,6,1) True - sage: W12.is_t_design(4) # optional - gap_package_design + sage: W12.is_t_design(4) True Further examples:: @@ -1924,8 +1925,8 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True, sage: TD.is_resolvable() True - sage: AG = designs.AffineGeometryDesign(3,1,GF(2)) # needs sage.rings.finite_rings - sage: AG.is_resolvable() # needs sage.rings.finite_rings + sage: AG = designs.AffineGeometryDesign(3,1,GF(2)) # needs sage.combinat + sage: AG.is_resolvable() # needs sage.combinat True Their classes:: @@ -1936,10 +1937,11 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True, sage: cls # random [[[0, 3], [1, 2]], [[1, 3], [0, 2]]] - sage: b, cls = AG.is_resolvable(True) # needs sage.rings.finite_rings + sage: # needs sage.combinat + sage: b, cls = AG.is_resolvable(True) sage: b True - sage: cls # random + sage: cls # random [[[6, 7], [4, 5], [0, 1], [2, 3]], [[5, 7], [0, 4], [3, 6], [1, 2]], [[0, 2], [4, 7], [1, 3], [5, 6]], @@ -1958,9 +1960,10 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True, TESTS:: - sage: _, cls1 = AG.is_resolvable(certificate=True) # needs sage.rings.finite_rings - sage: _, cls2 = AG.is_resolvable(certificate=True) # needs sage.rings.finite_rings - sage: cls1 is cls2 # needs sage.rings.finite_rings + sage: # needs sage.combinat + sage: _, cls1 = AG.is_resolvable(certificate=True) + sage: _, cls2 = AG.is_resolvable(certificate=True) + sage: cls1 is cls2 False """ if self._classes is None: diff --git a/src/sage/combinat/designs/orthogonal_arrays.py b/src/sage/combinat/designs/orthogonal_arrays.py index c4936f79853..aeab69acff1 100644 --- a/src/sage/combinat/designs/orthogonal_arrays.py +++ b/src/sage/combinat/designs/orthogonal_arrays.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings sage.schemes r""" Orthogonal arrays (OA) diff --git a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py index 1f434d49494..56f7cbc3bac 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py +++ b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py @@ -64,8 +64,8 @@ def construction_3_3(k,n,m,i,explain_construction=False): sage: from sage.combinat.designs.orthogonal_arrays_find_recursive import find_construction_3_3 sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3 sage: from sage.combinat.designs.orthogonal_arrays import is_orthogonal_array - sage: k=11;n=177 - sage: is_orthogonal_array(construction_3_3(*find_construction_3_3(k,n)[1]),k,n,2) + sage: k = 11; n = 177 + sage: is_orthogonal_array(construction_3_3(*find_construction_3_3(k,n)[1]),k,n,2) # needs sage.schemes True sage: print(designs.orthogonal_arrays.explain_construction(9,91)) @@ -134,8 +134,8 @@ def construction_3_4(k,n,m,r,s,explain_construction=False): sage: from sage.combinat.designs.orthogonal_arrays_find_recursive import find_construction_3_4 sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4 sage: from sage.combinat.designs.orthogonal_arrays import is_orthogonal_array - sage: k=8;n=196 - sage: is_orthogonal_array(construction_3_4(*find_construction_3_4(k,n)[1]),k,n,2) + sage: k = 8; n = 196 + sage: is_orthogonal_array(construction_3_4(*find_construction_3_4(k,n)[1]),k,n,2) # needs sage.schemes True sage: print(designs.orthogonal_arrays.explain_construction(8,164)) @@ -210,7 +210,7 @@ def construction_3_5(k,n,m,r,s,t,explain_construction=False): sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5 sage: from sage.combinat.designs.orthogonal_arrays import is_orthogonal_array sage: k=8;n=111 - sage: is_orthogonal_array(construction_3_5(*find_construction_3_5(k,n)[1]),k,n,2) + sage: is_orthogonal_array(construction_3_5(*find_construction_3_5(k,n)[1]),k,n,2) # needs sage.schemes True sage: print(designs.orthogonal_arrays.explain_construction(8,90)) @@ -302,7 +302,7 @@ def construction_3_6(k,n,m,i,explain_construction=False): sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_6 sage: from sage.combinat.designs.orthogonal_arrays import is_orthogonal_array sage: k=8;n=95 - sage: is_orthogonal_array(construction_3_6(*find_construction_3_6(k,n)[1]),k,n,2) + sage: is_orthogonal_array(construction_3_6(*find_construction_3_6(k,n)[1]),k,n,2) # needs sage.schemes True sage: print(designs.orthogonal_arrays.explain_construction(10,756)) @@ -497,7 +497,7 @@ def construction_q_x(k, q, x, check=True, explain_construction=False): EXAMPLES:: sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_q_x - sage: _ = construction_q_x(9,16,6) + sage: _ = construction_q_x(9,16,6) # needs sage.schemes sage: print(designs.orthogonal_arrays.explain_construction(9,158)) (q-x)-construction with q=16,x=6 from: @@ -650,11 +650,11 @@ def thwart_lemma_3_5(k,n,m,a,b,c,d=0,complement=False,explain_construction=False sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_3_5 sage: from sage.combinat.designs.designs_pyx import is_orthogonal_array - sage: OA = thwart_lemma_3_5(6,23,7,5,7,8) - sage: is_orthogonal_array(OA,6,23*7+5+7+8,2) + sage: OA = thwart_lemma_3_5(6,23,7,5,7,8) # needs sage.schemes + sage: is_orthogonal_array(OA,6,23*7+5+7+8,2) # needs sage.schemes True - sage: print(designs.orthogonal_arrays.explain_construction(10,408)) + sage: print(designs.orthogonal_arrays.explain_construction(10,408)) # needs sage.schemes Lemma 4.1 with n=13,m=28 from: Charles J.Colbourn, Jeffrey H. Dinitz, Mieczyslaw Wojtas, Thwarts in transversal designs, @@ -784,7 +784,7 @@ def thwart_lemma_4_1(k,n,m,explain_construction=False): EXAMPLES:: - sage: print(designs.orthogonal_arrays.explain_construction(10,408)) + sage: print(designs.orthogonal_arrays.explain_construction(10,408)) # needs sage.schemes Lemma 4.1 with n=13,m=28 from: Charles J.Colbourn, Jeffrey H. Dinitz, Mieczyslaw Wojtas, Thwarts in transversal designs, @@ -960,25 +960,21 @@ def three_factor_product(k,n1,n2,n3,check=False,explain_construction=False): EXAMPLES:: + sage: # needs sage.schemes sage: from sage.combinat.designs.designs_pyx import is_orthogonal_array sage: from sage.combinat.designs.orthogonal_arrays_build_recursive import three_factor_product - sage: OA = three_factor_product(4,4,4,4) sage: is_orthogonal_array(OA,5,64) True - sage: OA = three_factor_product(4,3,4,5) sage: is_orthogonal_array(OA,5,60) True - sage: OA = three_factor_product(5,4,5,7) sage: is_orthogonal_array(OA,6,140) True - sage: OA = three_factor_product(9,8,9,9) # long time sage: is_orthogonal_array(OA,10,8*9*9) # long time True - sage: print(designs.orthogonal_arrays.explain_construction(10,648)) Three-factor product with n=8.9.9 from: Peter J. Dukes, Alan C.H. Ling, diff --git a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx index 1843cbe00e8..066eecb9197 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +++ b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings sage.schemes # cython: cdivision=True r""" Orthogonal arrays (find recursive constructions) diff --git a/src/sage/combinat/designs/resolvable_bibd.py b/src/sage/combinat/designs/resolvable_bibd.py index 4af0bed4bb6..e52cb376b6c 100644 --- a/src/sage/combinat/designs/resolvable_bibd.py +++ b/src/sage/combinat/designs/resolvable_bibd.py @@ -180,7 +180,7 @@ def kirkman_triple_system(v,existence=False): TESTS:: - sage: for i in range(3,300,6): + sage: for i in range(3,300,6): # needs sage.combinat ....: _ = designs.kirkman_triple_system(i) """ if v % 6 != 3: @@ -458,7 +458,7 @@ def PBD_4_7(v,check=True, existence=False): All values `\leq 300`:: - sage: for i in range(1,300,3): + sage: for i in range(1,300,3): # needs sage.schemes ....: if i not in [10,19,31]: ....: assert PBD_4_7(i,existence=True) is True ....: _ = PBD_4_7(i,check=True) @@ -711,16 +711,16 @@ def PBD_4_7_from_Y(gdd,check=True): EXAMPLES:: sage: from sage.combinat.designs.resolvable_bibd import PBD_4_7_from_Y - sage: PBD_4_7_from_Y(designs.transversal_design(7,8)) + sage: PBD_4_7_from_Y(designs.transversal_design(7,8)) # needs sage.schemes Pairwise Balanced Design on 169 points with sets of sizes in [4, 7] TESTS:: - sage: PBD_4_7_from_Y(designs.balanced_incomplete_block_design(10,10)) + sage: PBD_4_7_from_Y(designs.balanced_incomplete_block_design(10,10)) # needs sage.schemes Traceback (most recent call last): ... ValueError: The GDD should only contain blocks of size {4,5,7} but there are other: [10] - sage: PBD_4_7_from_Y(designs.transversal_design(4,3)) + sage: PBD_4_7_from_Y(designs.transversal_design(4,3)) # needs sage.schemes Traceback (most recent call last): ... RuntimeError: A group has size 3 but I do not know how to build a (10,[4,7])-PBD diff --git a/src/sage/combinat/diagram_algebras.py b/src/sage/combinat/diagram_algebras.py index 693b8dfe269..11d96acced8 100644 --- a/src/sage/combinat/diagram_algebras.py +++ b/src/sage/combinat/diagram_algebras.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Diagram and Partition Algebras diff --git a/src/sage/combinat/e_one_star.py b/src/sage/combinat/e_one_star.py index cb6e5607931..a41e116d068 100644 --- a/src/sage/combinat/e_one_star.py +++ b/src/sage/combinat/e_one_star.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Substitutions over unit cube faces (Rauzy fractals) diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py index 494e8154c80..4c75a15305c 100644 --- a/src/sage/combinat/finite_state_machine.py +++ b/src/sage/combinat/finite_state_machine.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.graphs sage.modules r""" Finite state machines, automata, transducers diff --git a/src/sage/combinat/finite_state_machine_generators.py b/src/sage/combinat/finite_state_machine_generators.py index b5b8abbbd9e..24d027c03d0 100644 --- a/src/sage/combinat/finite_state_machine_generators.py +++ b/src/sage/combinat/finite_state_machine_generators.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.graphs sage.modules r""" Common Automata and Transducers (Finite State Machines Generators) diff --git a/src/sage/combinat/fqsym.py b/src/sage/combinat/fqsym.py index 03c53e6520b..48780725faa 100644 --- a/src/sage/combinat/fqsym.py +++ b/src/sage/combinat/fqsym.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Free Quasi-symmetric functions diff --git a/src/sage/combinat/free_dendriform_algebra.py b/src/sage/combinat/free_dendriform_algebra.py index 1bdcd1dbe31..fb1cb498c79 100644 --- a/src/sage/combinat/free_dendriform_algebra.py +++ b/src/sage/combinat/free_dendriform_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Free Dendriform Algebras diff --git a/src/sage/combinat/free_prelie_algebra.py b/src/sage/combinat/free_prelie_algebra.py index 2354cbbe576..965c459720c 100644 --- a/src/sage/combinat/free_prelie_algebra.py +++ b/src/sage/combinat/free_prelie_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Free Pre-Lie Algebras diff --git a/src/sage/combinat/fully_commutative_elements.py b/src/sage/combinat/fully_commutative_elements.py index 79237fefe42..200b98b2f36 100644 --- a/src/sage/combinat/fully_commutative_elements.py +++ b/src/sage/combinat/fully_commutative_elements.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Fully commutative elements of Coxeter groups diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py index de1bf3e5269..ca4bf09b1b0 100644 --- a/src/sage/combinat/fully_packed_loop.py +++ b/src/sage/combinat/fully_packed_loop.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Fully packed loops diff --git a/src/sage/combinat/grossman_larson_algebras.py b/src/sage/combinat/grossman_larson_algebras.py index 8fcf8a2e5ec..db2f1de5eca 100644 --- a/src/sage/combinat/grossman_larson_algebras.py +++ b/src/sage/combinat/grossman_larson_algebras.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Grossman-Larson Hopf Algebras diff --git a/src/sage/combinat/growth.py b/src/sage/combinat/growth.py index cf8d18c1764..86d5070a590 100644 --- a/src/sage/combinat/growth.py +++ b/src/sage/combinat/growth.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.graphs r""" Growth diagrams and dual graded graphs diff --git a/src/sage/combinat/hall_polynomial.py b/src/sage/combinat/hall_polynomial.py index 19d65bc2263..9d2326e60f8 100644 --- a/src/sage/combinat/hall_polynomial.py +++ b/src/sage/combinat/hall_polynomial.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Hall Polynomials """ diff --git a/src/sage/combinat/integer_matrices.py b/src/sage/combinat/integer_matrices.py index 75e8e896db8..8d737c64349 100644 --- a/src/sage/combinat/integer_matrices.py +++ b/src/sage/combinat/integer_matrices.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Counting, generating, and manipulating non-negative integer matrices diff --git a/src/sage/combinat/integer_vectors_mod_permgroup.py b/src/sage/combinat/integer_vectors_mod_permgroup.py index 8503bd978c5..d00a3748149 100644 --- a/src/sage/combinat/integer_vectors_mod_permgroup.py +++ b/src/sage/combinat/integer_vectors_mod_permgroup.py @@ -1,4 +1,4 @@ -# optional - sage.combinat sage.groups +# sage.doctest: needs sage.combinat sage.groups r""" Integer vectors modulo the action of a permutation group """ @@ -27,7 +27,7 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation): r""" - Returns an enumerated set containing integer vectors which are + Return an enumerated set containing integer vectors which are maximal in their orbit under the action of the permutation group ``G`` for the lexicographic order. @@ -137,7 +137,9 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation): [[6, 0, 0], [5, 1, 0], [5, 0, 1], [4, 2, 0], [4, 1, 1], [4, 0, 2], [3, 3, 0], [3, 2, 1], [3, 1, 2], [2, 2, 2]] sage: I.category() - Join of Category of finite enumerated sets and Category of subquotients of finite sets and Category of quotients of sets + Join of Category of finite enumerated sets + and Category of subquotients of finite sets + and Category of quotients of sets To get the orbit of any integer vector `v` under the action of the group, use the method :meth:`~sage.combinat.integer_vectors_mod_permgroup.IntegerVectorsModPermutationGroup_All.orbit`; @@ -156,9 +158,9 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation): Let us check that canonical integer vectors of the symmetric group are just sorted list of integers:: - sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time - sage: p = iter(I) # long time - sage: for i in range(100): # long time + sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time + sage: p = iter(I) # long time + sage: for i in range(100): # long time ....: v = list(next(p)) ....: assert sorted(v, reverse=True) == v @@ -166,8 +168,8 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation): symmetric group `S_n` whose entries sum to `d` than partitions of `d` of at most `n` parts:: - sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time - sage: for i in range(10): # long time + sage: I = IntegerVectorsModPermutationGroup(SymmetricGroup(5)) # long time + sage: for i in range(10): # long time ....: d1 = I.subset(i).cardinality() ....: d2 = Partitions(i, max_length=5).cardinality() ....: print(d1) @@ -187,11 +189,12 @@ class IntegerVectorsModPermutationGroup(UniqueRepresentation): group ``G`` acting on a list of length `n`, all integer vectors of length `n` are canonical:: - sage: G = PermutationGroup([[(6,)]]) # long time - sage: G.cardinality() # long time + sage: # long time + sage: G = PermutationGroup([[(6,)]]) + sage: G.cardinality() 1 - sage: I = IntegerVectorsModPermutationGroup(G) # long time - sage: for i in range(10): # long time + sage: I = IntegerVectorsModPermutationGroup(G) + sage: for i in range(10): ....: d1 = I.subset(i).cardinality() ....: d2 = IntegerVectors(i,6).cardinality() ....: print(d1) @@ -245,9 +248,9 @@ class IntegerVectorsModPermutationGroup_All(UniqueRepresentation, RecursivelyEnu EXAMPLES:: - sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]])) - sage: I - Integer vectors of length 4 enumerated up to the action of Permutation Group with generators [(1,2,3,4)] + sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]])); I + Integer vectors of length 4 enumerated up to the action of + Permutation Group with generators [(1,2,3,4)] sage: I.cardinality() +Infinity sage: TestSuite(I).run() @@ -274,7 +277,8 @@ def __init__(self, G, sgs=None): sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]])) sage: I - Integer vectors of length 4 enumerated up to the action of Permutation Group with generators [(1,2,3,4)] + Integer vectors of length 4 enumerated up to the action of + Permutation Group with generators [(1,2,3,4)] sage: I.category() Category of infinite enumerated quotients of sets sage: TestSuite(I).run() @@ -575,10 +579,13 @@ class IntegerVectorsModPermutationGroup_with_constraints(UniqueRepresentation, R EXAMPLES:: - sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), max_part=1) + sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: max_part=1) sage: I.list() - [[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 0], [1, 1, 1, 1]] - sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=6, max_part=4) + [[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 0], + [1, 1, 1, 1]] + sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=6, max_part=4) sage: I.list() [[4, 2, 0, 0], [4, 1, 1, 0], [4, 1, 0, 1], [4, 0, 2, 0], [4, 0, 1, 1], [4, 0, 0, 2], [3, 3, 0, 0], [3, 2, 1, 0], [3, 2, 0, 1], [3, 1, 2, 0], @@ -641,7 +648,9 @@ def _repr_(self): def roots(self): r""" - Returns the root of generation of ``self``.This method is + Return the root of generation of ``self``. + + This method is required to build the tree structure of ``self`` which inherits from the class :class:`~sage.sets.recursively_enumerated_set.RecursivelyEnumeratedSet_forest`. @@ -656,7 +665,9 @@ def roots(self): def children(self, x): r""" - Returns the list of children of the element ``x``. This method + Return the list of children of the element ``x``. + + This method is required to build the tree structure of ``self`` which inherits from the class :class:`~sage.sets.recursively_enumerated_set.RecursivelyEnumeratedSet_forest`. @@ -671,7 +682,7 @@ def children(self, x): def permutation_group(self): r""" - Returns the permutation group given to define ``self``. + Return the permutation group given to define ``self``. EXAMPLES:: @@ -766,7 +777,7 @@ def __iter__(self): def is_canonical(self, v, check=True): r""" - Returns ``True`` if the integer list ``v`` is maximal in its + Return ``True`` if the integer list ``v`` is maximal in its orbit under the action of the permutation group given to define ``self``. Such integer vectors are said to be canonical. A vector `v` is canonical if and only if @@ -777,7 +788,8 @@ def is_canonical(self, v, check=True): EXAMPLES:: - sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), max_part=3) + sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: max_part=3) sage: I.is_canonical([3,0,0,0]) True sage: I.is_canonical([1,0,2,0]) @@ -798,11 +810,16 @@ def ambient(self): EXAMPLES:: - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), 6); S.ambient() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), 6) + sage: S.ambient() Integer vectors that sum to 6 - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), 6, max_part=12); S.ambient() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: 6, max_part=12) + sage: S.ambient() Integer vectors that sum to 6 with constraints: max_part=12 - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), max_part=12); S.ambient() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: max_part=12) + sage: S.ambient() Integer vectors with constraints: max_part=12 """ if self._sum is not None: @@ -819,12 +836,14 @@ def lift(self, elt): EXAMPLES:: - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), max_part=1) + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: max_part=1) sage: v = S.lift([1,0,1,0]); v [1, 0, 1, 0] sage: v in IntegerVectors(2,4,max_part=1) True - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=6) + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=6) sage: v = S.lift(S.list()[5]); v [4, 1, 1, 0] sage: v in IntegerVectors(n=6) @@ -847,7 +866,8 @@ def retract(self, elt): EXAMPLES:: - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=2, max_part=1) + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=2, max_part=1) sage: S.retract([1,1,0,0]) [1, 1, 0, 0] sage: S.retract([1,0,1,0]) @@ -873,22 +893,35 @@ def retract(self, elt): def an_element(self): r""" - Returns an element of ``self`` or raises an EmptySetError when - ``self`` is empty. + Return an element of ``self``. + + Raises an :class:`EmptySetError` when ``self`` is empty. EXAMPLES:: - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=0, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=0, max_part=1) + sage: S.an_element() [0, 0, 0, 0] - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=1, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=1, max_part=1) + sage: S.an_element() [1, 0, 0, 0] - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=2, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=2, max_part=1) + sage: S.an_element() [1, 1, 0, 0] - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=3, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=3, max_part=1) + sage: S.an_element() [1, 1, 1, 0] - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=4, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=4, max_part=1) + sage: S.an_element() [1, 1, 1, 1] - sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), sum=5, max_part=1); S.an_element() + sage: S = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), + ....: sum=5, max_part=1) + sage: S.an_element() Traceback (most recent call last): ... EmptySetError @@ -905,12 +938,12 @@ def an_element(self): def orbit(self, v): r""" - Returns the orbit of the vector ``v`` under the action of the + Return the orbit of the vector ``v`` under the action of the permutation group defining ``self``. The result is a set. INPUT: - - ``v`` - an element of ``self`` or any list of length the + - ``v`` -- an element of ``self`` or any list of length the degree of the permutation group. EXAMPLES: @@ -918,7 +951,7 @@ def orbit(self, v): We convert the result in a list in increasing lexicographic order, to get a reproducible doctest:: - sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]),4) + sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3,4)]]), 4) sage: I.orbit([1,1,1,1]) {[1, 1, 1, 1]} sage: sorted(I.orbit([3,0,0,1])) @@ -952,7 +985,7 @@ class Element(ClonableIntArray): def check(self): r""" - Checks that ``self`` meets the constraints of being an element of ``self.parent()``. + Check that ``self`` meets the constraints of being an element of ``self.parent()``. EXAMPLES:: diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py index 3aeeb543567..530f621ca31 100644 --- a/src/sage/combinat/k_tableau.py +++ b/src/sage/combinat/k_tableau.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Strong and weak tableaux diff --git a/src/sage/combinat/kazhdan_lusztig.py b/src/sage/combinat/kazhdan_lusztig.py index 0c213ea9013..11e50379d1d 100644 --- a/src/sage/combinat/kazhdan_lusztig.py +++ b/src/sage/combinat/kazhdan_lusztig.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Kazhdan-Lusztig Polynomials diff --git a/src/sage/combinat/key_polynomial.py b/src/sage/combinat/key_polynomial.py index d132b037de3..43db18cc72f 100644 --- a/src/sage/combinat/key_polynomial.py +++ b/src/sage/combinat/key_polynomial.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Key polynomials diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index 6174fe3df50..308721707fe 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.graphs sage.modules r""" Hadamard matrices diff --git a/src/sage/combinat/matrices/latin.py b/src/sage/combinat/matrices/latin.py index b2b21ff12d2..1a369bba355 100644 --- a/src/sage/combinat/matrices/latin.py +++ b/src/sage/combinat/matrices/latin.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.groups sage.modules r""" Latin Squares diff --git a/src/sage/combinat/ncsf_qsym/generic_basis_code.py b/src/sage/combinat/ncsf_qsym/generic_basis_code.py index 505b77d42e3..bbf4d7af76c 100644 --- a/src/sage/combinat/ncsf_qsym/generic_basis_code.py +++ b/src/sage/combinat/ncsf_qsym/generic_basis_code.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Generic code for bases diff --git a/src/sage/combinat/ncsf_qsym/ncsf.py b/src/sage/combinat/ncsf_qsym/ncsf.py index f9aafb014aa..b1bf18c4ae6 100644 --- a/src/sage/combinat/ncsf_qsym/ncsf.py +++ b/src/sage/combinat/ncsf_qsym/ncsf.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules """ Non-Commutative Symmetric Functions """ diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index fe4e58277b1..c4f6b1ff0f3 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Quasisymmetric functions diff --git a/src/sage/combinat/ncsf_qsym/tutorial.py b/src/sage/combinat/ncsf_qsym/tutorial.py index 78978507cb3..4b7f1d199ae 100644 --- a/src/sage/combinat/ncsf_qsym/tutorial.py +++ b/src/sage/combinat/ncsf_qsym/tutorial.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Introduction to Quasisymmetric Functions diff --git a/src/sage/combinat/ncsym/bases.py b/src/sage/combinat/ncsym/bases.py index 8b703487547..9d4aac2cdf1 100644 --- a/src/sage/combinat/ncsym/bases.py +++ b/src/sage/combinat/ncsym/bases.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bases for `NCSym` diff --git a/src/sage/combinat/ncsym/dual.py b/src/sage/combinat/ncsym/dual.py index 5acd9c8f176..4b2ca62f86d 100644 --- a/src/sage/combinat/ncsym/dual.py +++ b/src/sage/combinat/ncsym/dual.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Dual Symmetric Functions in Non-Commuting Variables diff --git a/src/sage/combinat/ncsym/ncsym.py b/src/sage/combinat/ncsym/ncsym.py index 64772ade2d7..dfc77b9b7bc 100644 --- a/src/sage/combinat/ncsym/ncsym.py +++ b/src/sage/combinat/ncsym/ncsym.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Symmetric Functions in Non-Commuting Variables diff --git a/src/sage/combinat/nu_dyck_word.py b/src/sage/combinat/nu_dyck_word.py index efb0af7f572..654b9a4c2a3 100644 --- a/src/sage/combinat/nu_dyck_word.py +++ b/src/sage/combinat/nu_dyck_word.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" `\nu`-Dyck Words diff --git a/src/sage/combinat/nu_tamari_lattice.py b/src/sage/combinat/nu_tamari_lattice.py index 0d6b391aa8b..433b7058cf5 100644 --- a/src/sage/combinat/nu_tamari_lattice.py +++ b/src/sage/combinat/nu_tamari_lattice.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat r""" `\nu`-Tamari lattice diff --git a/src/sage/combinat/parallelogram_polyomino.py b/src/sage/combinat/parallelogram_polyomino.py index 9c4ceedfd19..9aea6a3aaf5 100644 --- a/src/sage/combinat/parallelogram_polyomino.py +++ b/src/sage/combinat/parallelogram_polyomino.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Parallelogram Polyominoes ========================= diff --git a/src/sage/combinat/partition_algebra.py b/src/sage/combinat/partition_algebra.py index 0b7eb06c3a5..cca9b164aec 100644 --- a/src/sage/combinat/partition_algebra.py +++ b/src/sage/combinat/partition_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Partition/Diagram Algebras """ diff --git a/src/sage/combinat/partition_kleshchev.py b/src/sage/combinat/partition_kleshchev.py index 06781aa96ed..29936e4db39 100644 --- a/src/sage/combinat/partition_kleshchev.py +++ b/src/sage/combinat/partition_kleshchev.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Kleshchev partitions ==================== diff --git a/src/sage/combinat/partition_shifting_algebras.py b/src/sage/combinat/partition_shifting_algebras.py index 7dfee4fa460..e8f22589eb3 100644 --- a/src/sage/combinat/partition_shifting_algebras.py +++ b/src/sage/combinat/partition_shifting_algebras.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Partition Shifting Algebras diff --git a/src/sage/combinat/posets/d_complete.py b/src/sage/combinat/posets/d_complete.py index 6bfe6eca61e..aa3c527ef8f 100644 --- a/src/sage/combinat/posets/d_complete.py +++ b/src/sage/combinat/posets/d_complete.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" D-Complete Posets diff --git a/src/sage/combinat/posets/hasse_cython_flint.pyx b/src/sage/combinat/posets/hasse_cython_flint.pyx index 0b33eed0b3f..fcbe29faaf6 100644 --- a/src/sage/combinat/posets/hasse_cython_flint.pyx +++ b/src/sage/combinat/posets/hasse_cython_flint.pyx @@ -1,4 +1,5 @@ # cython: binding=True +# sage.doctest: needs sage.libs.flint sage.graphs sage.modules r""" Some fast computations for finite posets using FLINT matrices """ diff --git a/src/sage/combinat/posets/incidence_algebras.py b/src/sage/combinat/posets/incidence_algebras.py index 204c4661b3b..dfd18f8c338 100644 --- a/src/sage/combinat/posets/incidence_algebras.py +++ b/src/sage/combinat/posets/incidence_algebras.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.modules r""" Incidence Algebras """ diff --git a/src/sage/combinat/posets/lattices.py b/src/sage/combinat/posets/lattices.py index 99e403765f8..8fb9055afdb 100644 --- a/src/sage/combinat/posets/lattices.py +++ b/src/sage/combinat/posets/lattices.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.modules r""" Finite lattices and semilattices @@ -2293,9 +2293,9 @@ def is_orthocomplemented(self, unique=False): False sage: D6 = posets.DiamondPoset(6) - sage: D6.is_orthocomplemented() + sage: D6.is_orthocomplemented() # needs sage.groups True - sage: D6.is_orthocomplemented(unique=True) + sage: D6.is_orthocomplemented(unique=True) # needs sage.groups False sage: hexagon = LatticePoset({0:[1, 2], 1:[3], 2:[4], 3:[5], 4:[5]}) @@ -2453,8 +2453,8 @@ def is_geometric(self): Canonical example is the lattice of partitions of finite set ordered by refinement:: - sage: L = posets.SetPartitions(4) - sage: L.is_geometric() + sage: L = posets.SetPartitions(4) # needs sage.combinat + sage: L.is_geometric() # needs sage.combinat True Smallest example of geometric lattice that is not modular:: @@ -2754,8 +2754,8 @@ def is_upper_semimodular(self, certificate=False): sage: L.is_upper_semimodular() False - sage: L = LatticePoset(posets.IntegerPartitions(4)) - sage: L.is_upper_semimodular() + sage: L = LatticePoset(posets.IntegerPartitions(4)) # needs sage.combinat + sage: L.is_upper_semimodular() # needs sage.combinat True sage: L = LatticePoset({1:[2, 3, 4], 2: [5], 3:[5, 6], 4:[6], 5:[7], 6:[7]}) @@ -4021,21 +4021,21 @@ def is_subdirectly_reducible(self, certificate=False): EXAMPLES:: sage: N5 = posets.PentagonPoset() - sage: N5.is_subdirectly_reducible() + sage: N5.is_subdirectly_reducible() # needs sage.combinat False sage: hex = LatticePoset({1: [2, 3], 2: [4], 3: [5], 4: [6], 5: [6]}) - sage: hex.is_subdirectly_reducible() + sage: hex.is_subdirectly_reducible() # needs sage.combinat True - sage: hex.is_subdirectly_reducible(certificate=True) + sage: hex.is_subdirectly_reducible(certificate=True) # needs sage.combinat (True, (Finite lattice containing 5 elements, Finite lattice containing 5 elements)) - sage: N5.is_subdirectly_reducible(certificate=True) + sage: N5.is_subdirectly_reducible(certificate=True) # needs sage.combinat (False, (2, 3)) - sage: res, cert = hex.is_subdirectly_reducible(certificate=True) - sage: cert[0].is_isomorphic(N5) + sage: res, cert = hex.is_subdirectly_reducible(certificate=True) # needs sage.combinat + sage: cert[0].is_isomorphic(N5) # needs sage.combinat True .. SEEALSO:: @@ -4241,7 +4241,7 @@ def is_constructible_by_doublings(self, type) -> bool: sage: posets.PentagonPoset().is_constructible_by_doublings('interval') True - sage: posets.DiamondPoset(5).is_constructible_by_doublings('any') + sage: posets.DiamondPoset(5).is_constructible_by_doublings('any') # needs sage.combinat False After doubling both upper and lower pseudo-interval a lattice is @@ -5006,7 +5006,7 @@ def feichtner_yuzvinsky_ring(self, G, use_defining=False, base_ring=None): sage: Arr = H(a-b, b-c, c-d, d-a) sage: P = LatticePoset(Arr.intersection_poset()) sage: FY = P.feichtner_yuzvinsky_ring([P.top(),5,1,2,3,4]) - sage: FY.defining_ideal().groebner_basis() + sage: FY.defining_ideal().groebner_basis() # needs sage.libs.singular [h0^2 - h0*h1, h1^2, h2, h3, h4, h5] TESTS:: diff --git a/src/sage/combinat/posets/moebius_algebra.py b/src/sage/combinat/posets/moebius_algebra.py index aada2725078..00691051587 100644 --- a/src/sage/combinat/posets/moebius_algebra.py +++ b/src/sage/combinat/posets/moebius_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.modules r""" Möbius Algebras """ diff --git a/src/sage/combinat/recognizable_series.py b/src/sage/combinat/recognizable_series.py index ca2f11bd6ff..698dd959619 100644 --- a/src/sage/combinat/recognizable_series.py +++ b/src/sage/combinat/recognizable_series.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Recognizable Series diff --git a/src/sage/combinat/regular_sequence.py b/src/sage/combinat/regular_sequence.py index afb83bed6f7..a10ceb7cf17 100644 --- a/src/sage/combinat/regular_sequence.py +++ b/src/sage/combinat/regular_sequence.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules sage.symbolic +# sage.doctest: needs sage.combinat sage.modules sage.symbolic r""" `k`-regular sequences diff --git a/src/sage/combinat/rigged_configurations/bij_abstract_class.py b/src/sage/combinat/rigged_configurations/bij_abstract_class.py index 66ad0ac37ce..520ce241d57 100644 --- a/src/sage/combinat/rigged_configurations/bij_abstract_class.py +++ b/src/sage/combinat/rigged_configurations/bij_abstract_class.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Abstract classes for the rigged configuration bijections diff --git a/src/sage/combinat/rigged_configurations/bij_infinity.py b/src/sage/combinat/rigged_configurations/bij_infinity.py index 8d9700e168a..0fd8ee7fdc9 100644 --- a/src/sage/combinat/rigged_configurations/bij_infinity.py +++ b/src/sage/combinat/rigged_configurations/bij_infinity.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection between rigged configurations for `B(\infty)` and marginally large tableaux diff --git a/src/sage/combinat/rigged_configurations/bij_type_A.py b/src/sage/combinat/rigged_configurations/bij_type_A.py index 198ba0fc433..2a623f322da 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `A_n^{(1)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py index dee72713e12..ceb6ad8f1b8 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_dual.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `A_{2n}^{(2)\dagger}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py index 1c0d587139a..8fa552a1077 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_even.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_even.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `A_{2n}^{(2)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py index 42a8cf956fb..ea7862ef3ef 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py +++ b/src/sage/combinat/rigged_configurations/bij_type_A2_odd.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `A_{2n-1}^{(2)}`. diff --git a/src/sage/combinat/rigged_configurations/bij_type_B.py b/src/sage/combinat/rigged_configurations/bij_type_B.py index fd924150380..299f9e2e94c 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_B.py +++ b/src/sage/combinat/rigged_configurations/bij_type_B.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `B_n^{(1)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_C.py b/src/sage/combinat/rigged_configurations/bij_type_C.py index d04267b5569..9e0997e1479 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_C.py +++ b/src/sage/combinat/rigged_configurations/bij_type_C.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `C_n^{(1)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_D.py b/src/sage/combinat/rigged_configurations/bij_type_D.py index 12fb6c6be2c..ab9b41b89bd 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `D_n^{(1)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py index f143b3ce38a..b82ff955642 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_tri.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_tri.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `D_4^{(3)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py index dbc049d6ae0..ce177ffb468 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py +++ b/src/sage/combinat/rigged_configurations/bij_type_D_twisted.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `D_{n+1}^{(2)}` diff --git a/src/sage/combinat/rigged_configurations/bij_type_E67.py b/src/sage/combinat/rigged_configurations/bij_type_E67.py index 3d258443276..af59d3048f5 100644 --- a/src/sage/combinat/rigged_configurations/bij_type_E67.py +++ b/src/sage/combinat/rigged_configurations/bij_type_E67.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection classes for type `E_{6,7}^{(1)}` diff --git a/src/sage/combinat/rigged_configurations/bijection.py b/src/sage/combinat/rigged_configurations/bijection.py index f312f12930c..850270930a6 100644 --- a/src/sage/combinat/rigged_configurations/bijection.py +++ b/src/sage/combinat/rigged_configurations/bijection.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Bijection between rigged configurations and KR tableaux diff --git a/src/sage/combinat/rigged_configurations/kleber_tree.py b/src/sage/combinat/rigged_configurations/kleber_tree.py index 6d056b6c678..2403ad7ab05 100644 --- a/src/sage/combinat/rigged_configurations/kleber_tree.py +++ b/src/sage/combinat/rigged_configurations/kleber_tree.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Kleber Trees diff --git a/src/sage/combinat/rigged_configurations/kr_tableaux.py b/src/sage/combinat/rigged_configurations/kr_tableaux.py index 84e3db6640c..3addee9e2e5 100644 --- a/src/sage/combinat/rigged_configurations/kr_tableaux.py +++ b/src/sage/combinat/rigged_configurations/kr_tableaux.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Kirillov-Reshetikhin Tableaux diff --git a/src/sage/combinat/rigged_configurations/rc_crystal.py b/src/sage/combinat/rigged_configurations/rc_crystal.py index dbd7fd047fe..647d3c6eb0d 100644 --- a/src/sage/combinat/rigged_configurations/rc_crystal.py +++ b/src/sage/combinat/rigged_configurations/rc_crystal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Crystal of Rigged Configurations diff --git a/src/sage/combinat/rigged_configurations/rc_infinity.py b/src/sage/combinat/rigged_configurations/rc_infinity.py index b988c5a6ff2..e592f9b3656 100644 --- a/src/sage/combinat/rigged_configurations/rc_infinity.py +++ b/src/sage/combinat/rigged_configurations/rc_infinity.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Rigged Configurations of `\mathcal{B}(\infty)` diff --git a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py index 542649cf9dd..088dd64f20f 100644 --- a/src/sage/combinat/rigged_configurations/rigged_configuration_element.py +++ b/src/sage/combinat/rigged_configurations/rigged_configuration_element.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Rigged Configuration Elements diff --git a/src/sage/combinat/rigged_configurations/rigged_configurations.py b/src/sage/combinat/rigged_configurations/rigged_configurations.py index a7073a700bb..b822a668612 100644 --- a/src/sage/combinat/rigged_configurations/rigged_configurations.py +++ b/src/sage/combinat/rigged_configurations/rigged_configurations.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Rigged Configurations diff --git a/src/sage/combinat/rigged_configurations/rigged_partition.pyx b/src/sage/combinat/rigged_configurations/rigged_partition.pyx index d5ecb7c778d..694b3dd5977 100644 --- a/src/sage/combinat/rigged_configurations/rigged_partition.pyx +++ b/src/sage/combinat/rigged_configurations/rigged_partition.pyx @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Rigged Partitions diff --git a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py index ce4c2ad2ab4..3314986004f 100644 --- a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +++ b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Tensor Product of Kirillov-Reshetikhin Tableaux diff --git a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py index c816d2140a6..8db94443af2 100644 --- a/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +++ b/src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Tensor Product of Kirillov-Reshetikhin Tableaux Elements diff --git a/src/sage/combinat/rsk.py b/src/sage/combinat/rsk.py index 1a4ae2e548f..2c787878768 100644 --- a/src/sage/combinat/rsk.py +++ b/src/sage/combinat/rsk.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Robinson-Schensted-Knuth correspondence diff --git a/src/sage/combinat/schubert_polynomial.py b/src/sage/combinat/schubert_polynomial.py index 441dbbe3317..e4611fcdc55 100644 --- a/src/sage/combinat/schubert_polynomial.py +++ b/src/sage/combinat/schubert_polynomial.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Schubert Polynomials diff --git a/src/sage/combinat/sf/character.py b/src/sage/combinat/sf/character.py index eda80d2d1c3..3bd8ab5e0a1 100644 --- a/src/sage/combinat/sf/character.py +++ b/src/sage/combinat/sf/character.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Characters of the symmetric group as bases of the symmetric functions diff --git a/src/sage/combinat/sf/classical.py b/src/sage/combinat/sf/classical.py index 73bf285c14f..3151566ed6d 100644 --- a/src/sage/combinat/sf/classical.py +++ b/src/sage/combinat/sf/classical.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Classical symmetric functions """ diff --git a/src/sage/combinat/sf/dual.py b/src/sage/combinat/sf/dual.py index 90ed7f7ac8c..6a68eb7dfe6 100644 --- a/src/sage/combinat/sf/dual.py +++ b/src/sage/combinat/sf/dual.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Generic dual bases symmetric functions """ diff --git a/src/sage/combinat/sf/elementary.py b/src/sage/combinat/sf/elementary.py index a7e5d9cf44c..ce9cae6cdc8 100644 --- a/src/sage/combinat/sf/elementary.py +++ b/src/sage/combinat/sf/elementary.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Elementary symmetric functions """ diff --git a/src/sage/combinat/sf/hall_littlewood.py b/src/sage/combinat/sf/hall_littlewood.py index 1397e5686f3..c3376537a35 100644 --- a/src/sage/combinat/sf/hall_littlewood.py +++ b/src/sage/combinat/sf/hall_littlewood.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Hall-Littlewood Polynomials diff --git a/src/sage/combinat/sf/hecke.py b/src/sage/combinat/sf/hecke.py index 514a2cbf1d8..5cea11ccb2c 100644 --- a/src/sage/combinat/sf/hecke.py +++ b/src/sage/combinat/sf/hecke.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Hecke Character Basis diff --git a/src/sage/combinat/sf/homogeneous.py b/src/sage/combinat/sf/homogeneous.py index da55fef0426..e83dd16861e 100644 --- a/src/sage/combinat/sf/homogeneous.py +++ b/src/sage/combinat/sf/homogeneous.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Homogeneous symmetric functions diff --git a/src/sage/combinat/sf/jack.py b/src/sage/combinat/sf/jack.py index 9d479f930a8..a7a0fec6186 100644 --- a/src/sage/combinat/sf/jack.py +++ b/src/sage/combinat/sf/jack.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Jack Symmetric Functions diff --git a/src/sage/combinat/sf/k_dual.py b/src/sage/combinat/sf/k_dual.py index 787ed2051ad..be19a9fd413 100644 --- a/src/sage/combinat/sf/k_dual.py +++ b/src/sage/combinat/sf/k_dual.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Quotient of symmetric function space by ideal generated by Hall-Littlewood symmetric functions diff --git a/src/sage/combinat/sf/kfpoly.py b/src/sage/combinat/sf/kfpoly.py index 88eb77485e8..09283745aa5 100644 --- a/src/sage/combinat/sf/kfpoly.py +++ b/src/sage/combinat/sf/kfpoly.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Kostka-Foulkes Polynomials diff --git a/src/sage/combinat/sf/llt.py b/src/sage/combinat/sf/llt.py index fe7e17aa58d..6e0e20d49ba 100644 --- a/src/sage/combinat/sf/llt.py +++ b/src/sage/combinat/sf/llt.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" LLT symmetric functions diff --git a/src/sage/combinat/sf/macdonald.py b/src/sage/combinat/sf/macdonald.py index 4c85c726a8a..09a3ef98798 100644 --- a/src/sage/combinat/sf/macdonald.py +++ b/src/sage/combinat/sf/macdonald.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Macdonald Polynomials diff --git a/src/sage/combinat/sf/monomial.py b/src/sage/combinat/sf/monomial.py index 36f91772d4d..6c910527fc9 100644 --- a/src/sage/combinat/sf/monomial.py +++ b/src/sage/combinat/sf/monomial.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Monomial symmetric functions """ diff --git a/src/sage/combinat/sf/multiplicative.py b/src/sage/combinat/sf/multiplicative.py index 4e6c57ffffa..7ff9797f81a 100644 --- a/src/sage/combinat/sf/multiplicative.py +++ b/src/sage/combinat/sf/multiplicative.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Multiplicative symmetric functions diff --git a/src/sage/combinat/sf/new_kschur.py b/src/sage/combinat/sf/new_kschur.py index 551e776ebb6..e4c2abcc75a 100644 --- a/src/sage/combinat/sf/new_kschur.py +++ b/src/sage/combinat/sf/new_kschur.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ `k`-Schur Functions """ diff --git a/src/sage/combinat/sf/ns_macdonald.py b/src/sage/combinat/sf/ns_macdonald.py index 44075c054cf..8807bd95b87 100644 --- a/src/sage/combinat/sf/ns_macdonald.py +++ b/src/sage/combinat/sf/ns_macdonald.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Non-symmetric Macdonald Polynomials """ diff --git a/src/sage/combinat/sf/orthogonal.py b/src/sage/combinat/sf/orthogonal.py index 0e9e2053d51..3ab5f56debc 100644 --- a/src/sage/combinat/sf/orthogonal.py +++ b/src/sage/combinat/sf/orthogonal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Orthogonal Symmetric Functions diff --git a/src/sage/combinat/sf/orthotriang.py b/src/sage/combinat/sf/orthotriang.py index 96cae8e7384..2e1650e57a7 100644 --- a/src/sage/combinat/sf/orthotriang.py +++ b/src/sage/combinat/sf/orthotriang.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Symmetric functions defined by orthogonality and triangularity diff --git a/src/sage/combinat/sf/powersum.py b/src/sage/combinat/sf/powersum.py index fb9ecb31e91..bb20adf9941 100644 --- a/src/sage/combinat/sf/powersum.py +++ b/src/sage/combinat/sf/powersum.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Power sum symmetric functions """ diff --git a/src/sage/combinat/sf/schur.py b/src/sage/combinat/sf/schur.py index 202c31d7cee..299cf28da99 100644 --- a/src/sage/combinat/sf/schur.py +++ b/src/sage/combinat/sf/schur.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Schur symmetric functions """ diff --git a/src/sage/combinat/sf/sf.py b/src/sage/combinat/sf/sf.py index 56b3b96f279..aba6c941430 100644 --- a/src/sage/combinat/sf/sf.py +++ b/src/sage/combinat/sf/sf.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Symmetric functions, with their multiple realizations """ diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 432fbd06ef5..f5ebf888064 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Symmetric Functions diff --git a/src/sage/combinat/sf/symplectic.py b/src/sage/combinat/sf/symplectic.py index 7ee859ce6db..f6db1782489 100644 --- a/src/sage/combinat/sf/symplectic.py +++ b/src/sage/combinat/sf/symplectic.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Symplectic Symmetric Functions diff --git a/src/sage/combinat/sf/witt.py b/src/sage/combinat/sf/witt.py index cceebed7889..138b2647826 100644 --- a/src/sage/combinat/sf/witt.py +++ b/src/sage/combinat/sf/witt.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules """ Witt symmetric functions """ diff --git a/src/sage/combinat/shifted_primed_tableau.py b/src/sage/combinat/shifted_primed_tableau.py index 2ca02da12da..e9a320cd0ea 100644 --- a/src/sage/combinat/shifted_primed_tableau.py +++ b/src/sage/combinat/shifted_primed_tableau.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules """ Shifted primed tableaux diff --git a/src/sage/combinat/similarity_class_type.py b/src/sage/combinat/similarity_class_type.py index 94e87115ea3..01c0ea3aac5 100644 --- a/src/sage/combinat/similarity_class_type.py +++ b/src/sage/combinat/similarity_class_type.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Similarity class types of matrices with entries in a finite field diff --git a/src/sage/combinat/sloane_functions.py b/src/sage/combinat/sloane_functions.py index e5c99b71fe7..e9911d47506 100644 --- a/src/sage/combinat/sloane_functions.py +++ b/src/sage/combinat/sloane_functions.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.libs.gap sage.libs.flint sage.libs.pari sage.modules r""" Functions that compute some of the sequences in Sloane's tables diff --git a/src/sage/combinat/specht_module.py b/src/sage/combinat/specht_module.py index 678933d78fb..9db20d0b184 100644 --- a/src/sage/combinat/specht_module.py +++ b/src/sage/combinat/specht_module.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Specht Modules diff --git a/src/sage/combinat/species/misc.py b/src/sage/combinat/species/misc.py index 7296c77e54d..a516beb56ae 100644 --- a/src/sage/combinat/species/misc.py +++ b/src/sage/combinat/species/misc.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.groups """ Miscellaneous Functions """ diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index c9b08f1b4bb..3ed00b45ca4 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.flint """ Partition Species """ diff --git a/src/sage/combinat/species/permutation_species.py b/src/sage/combinat/species/permutation_species.py index aeb7ad3ca3b..4549e0354ff 100644 --- a/src/sage/combinat/species/permutation_species.py +++ b/src/sage/combinat/species/permutation_species.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.groups sage.libs.flint """ Permutation species """ diff --git a/src/sage/combinat/subword_complex.py b/src/sage/combinat/subword_complex.py index de7eefe946e..1a1b05dbf17 100644 --- a/src/sage/combinat/subword_complex.py +++ b/src/sage/combinat/subword_complex.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Subword complex diff --git a/src/sage/combinat/subword_complex_c.pyx b/src/sage/combinat/subword_complex_c.pyx index 39200e0c339..66da5184356 100644 --- a/src/sage/combinat/subword_complex_c.pyx +++ b/src/sage/combinat/subword_complex_c.pyx @@ -1,3 +1,5 @@ +# sage.doctest: needs sage.modules + cpdef int _flip_c(W, set positions, list extended_root_conf_indices, int i, side="both"): r""" diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index 3884747f825..3e8b27e9210 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -1,4 +1,4 @@ -# optional - sage.combinat sage.modules sage.groups +# sage.doctest: needs sage.combinat sage.modules sage.groups r""" Symmetric Group Algebra """ diff --git a/src/sage/combinat/symmetric_group_representations.py b/src/sage/combinat/symmetric_group_representations.py index ee518756525..4eae56f9e0a 100644 --- a/src/sage/combinat/symmetric_group_representations.py +++ b/src/sage/combinat/symmetric_group_representations.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules sage.groups r""" Representations of the Symmetric Group diff --git a/src/sage/combinat/tamari_lattices.py b/src/sage/combinat/tamari_lattices.py index 6ef7dd06cdc..e074e8efc8b 100644 --- a/src/sage/combinat/tamari_lattices.py +++ b/src/sage/combinat/tamari_lattices.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.modules r""" Generalized Tamari lattices diff --git a/src/sage/combinat/tiling.py b/src/sage/combinat/tiling.py index 676a4846b23..aaa9a7227b8 100644 --- a/src/sage/combinat/tiling.py +++ b/src/sage/combinat/tiling.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Tiling Solver diff --git a/src/sage/combinat/words/paths.py b/src/sage/combinat/words/paths.py index 326f7f7090c..cc4aecd250b 100644 --- a/src/sage/combinat/words/paths.py +++ b/src/sage/combinat/words/paths.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat sage.modules r""" Word paths diff --git a/src/sage/graphs/base/static_dense_graph.pyx b/src/sage/graphs/base/static_dense_graph.pyx index 2014289457d..78711fae2f1 100644 --- a/src/sage/graphs/base/static_dense_graph.pyx +++ b/src/sage/graphs/base/static_dense_graph.pyx @@ -344,7 +344,7 @@ def triangles_count(G): sage: from sage.graphs.base.static_dense_graph import triangles_count sage: triangles_count(graphs.PetersenGraph()) {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0} - sage: sum(triangles_count(graphs.CompleteGraph(15)).values()) == 3 * binomial(15, 3) + sage: sum(triangles_count(graphs.CompleteGraph(15)).values()) == 3 * binomial(15, 3) # needs sage.symbolic True """ from sage.rings.integer import Integer diff --git a/src/sage/graphs/base/static_sparse_graph.pyx b/src/sage/graphs/base/static_sparse_graph.pyx index b5462299058..4b98ff027a3 100644 --- a/src/sage/graphs/base/static_sparse_graph.pyx +++ b/src/sage/graphs/base/static_sparse_graph.pyx @@ -925,7 +925,7 @@ def triangles_count(G): sage: from sage.graphs.base.static_sparse_graph import triangles_count sage: triangles_count(graphs.PetersenGraph()) {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0} - sage: sum(triangles_count(graphs.CompleteGraph(15)).values()) == 3*binomial(15,3) + sage: sum(triangles_count(graphs.CompleteGraph(15)).values()) == 3*binomial(15,3) # needs sage.symbolic True """ from sage.rings.integer import Integer @@ -1023,8 +1023,8 @@ def spectral_radius(G, prec=1e-10): sage: G = Graph([(0,1),(0,2),(1,2),(1,3),(2,4),(3,4)]) sage: e_min, e_max = spectral_radius(G, 1e-14) - sage: e = max(G.adjacency_matrix().charpoly().roots(AA, multiplicities=False)) # needs sage.modules - sage: e_min < e < e_max # needs sage.modules + sage: e = max(G.adjacency_matrix().charpoly().roots(AA, multiplicities=False)) # needs sage.modules sage.rings.number_field + sage: e_min < e < e_max # needs sage.modules sage.rings.number_field sage.symbolic True sage: G.spectral_radius() # abs tol 1e-9 @@ -1041,8 +1041,8 @@ def spectral_radius(G, prec=1e-10): sage: p = G.adjacency_matrix(sparse=True).charpoly() sage: p x^201 - x^199 - 1 - sage: r = p.roots(AA, multiplicities=False)[0] - sage: e_min < r < e_max + sage: r = p.roots(AA, multiplicities=False)[0] # needs sage.rings.number_field + sage: e_min < r < e_max # needs sage.rings.number_field True A much larger example:: @@ -1061,7 +1061,7 @@ def spectral_radius(G, prec=1e-10): sage: G.add_edges([(0,0),(0,0),(0,1),(1,0)]) sage: spectral_radius(G, 1e-14) # abs tol 1e-14 (2.414213562373094, 2.414213562373095) - sage: max(G.adjacency_matrix().eigenvalues(AA)) # needs sage.modules + sage: max(G.adjacency_matrix().eigenvalues(AA)) # needs sage.modules sage.rings.number_field 2.414213562373095? Some bipartite graphs:: @@ -1092,7 +1092,7 @@ def spectral_radius(G, prec=1e-10): ... ValueError: precision (=1.00000000000000e-20) is too small - sage: for _ in range(100): # needs sage.modules + sage: for _ in range(100): # needs sage.modules sage.rings.number_field ....: G = digraphs.RandomDirectedGNM(10,35) ....: if not G.is_strongly_connected(): ....: continue diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index f707ee2a968..19746f1710c 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -1507,7 +1507,7 @@ def matching_polynomial(self, algorithm="Godsil", name=None): EXAMPLES:: - sage: BipartiteGraph(graphs.CubeGraph(3)).matching_polynomial() + sage: BipartiteGraph(graphs.CubeGraph(3)).matching_polynomial() # needs sage.libs.flint x^8 - 12*x^6 + 42*x^4 - 44*x^2 + 9 :: @@ -1530,14 +1530,15 @@ def matching_polynomial(self, algorithm="Godsil", name=None): polynomial:: sage: g = graphs.RandomTree(20) - sage: p = g.characteristic_polynomial() - sage: p == BipartiteGraph(g).matching_polynomial(algorithm='rook') + sage: p = g.characteristic_polynomial() # needs sage.modules + sage: p == BipartiteGraph(g).matching_polynomial(algorithm='rook') # needs sage.modules True TESTS:: + sage: # needs sage.modules sage: g = BipartiteGraph(matrix.ones(4, 3)) - sage: g.matching_polynomial() + sage: g.matching_polynomial() # needs sage.libs.flint x^7 - 12*x^5 + 36*x^3 - 24*x sage: g.matching_polynomial(algorithm="rook") x^7 - 12*x^5 + 36*x^3 - 24*x @@ -2138,7 +2139,7 @@ class :class:`MixedIntegerLinearProgram 4 sage: B.matching(use_edge_labels=True, value_only=True, algorithm='Edmonds') # needs networkx 4 - sage: B.matching(use_edge_labels=True, value_only=True, algorithm='LP') + sage: B.matching(use_edge_labels=True, value_only=True, algorithm='LP') # needs sage.numerical.mip 4 sage: B.matching(use_edge_labels=True, value_only=True, algorithm='Eppstein') Traceback (most recent call last): @@ -2156,7 +2157,7 @@ class :class:`MixedIntegerLinearProgram 2 sage: B.matching(use_edge_labels=False, value_only=True, algorithm='Edmonds') # needs networkx 2 - sage: B.matching(use_edge_labels=False, value_only=True, algorithm='LP') + sage: B.matching(use_edge_labels=False, value_only=True, algorithm='LP') # needs sage.numerical.mip 2 With multiedges enabled:: @@ -2302,7 +2303,7 @@ def vertex_cover(self, algorithm="Konig", value_only=False, The two algorithms should return the same result:: - sage: # needs numpy + sage: # needs networkx numpy sage: g = BipartiteGraph(graphs.RandomBipartite(10, 10, .5)) sage: vc1 = g.vertex_cover(algorithm="Konig") sage: vc2 = g.vertex_cover(algorithm="Cliquer") diff --git a/src/sage/graphs/chrompoly.pyx b/src/sage/graphs/chrompoly.pyx index d0611a3df84..f596272219e 100644 --- a/src/sage/graphs/chrompoly.pyx +++ b/src/sage/graphs/chrompoly.pyx @@ -1,4 +1,5 @@ # cython: binding=True +# sage.doctest: needs sage.libs.flint sage.graphs """ Chromatic polynomial diff --git a/src/sage/graphs/connectivity.pyx b/src/sage/graphs/connectivity.pyx index 9e4942e75e6..5a206221da9 100644 --- a/src/sage/graphs/connectivity.pyx +++ b/src/sage/graphs/connectivity.pyx @@ -1078,8 +1078,9 @@ def edge_connectivity(G, sage: for u,v in tree.edge_iterator(labels=None): ....: tree.set_edge_label(u, v, random()) sage: minimum = min(tree.edge_labels()) - sage: [_, [(_, _, l)]] = edge_connectivity(tree, value_only=False, use_edge_labels=True) - sage: l == minimum + sage: [_, [(_, _, l)]] = edge_connectivity(tree, value_only=False, # needs sage.numerical.mip + ....: use_edge_labels=True) + sage: l == minimum # needs sage.numerical.mip True When ``value_only=True`` and ``implementation="sage"``, this function is @@ -1102,12 +1103,14 @@ def edge_connectivity(G, We check that the result with Boost is the same as the result without Boost:: sage: g = graphs.RandomGNP(15, .3) - sage: edge_connectivity(g, implementation="boost") == edge_connectivity(g, implementation="sage") + sage: (edge_connectivity(g, implementation="boost") # needs sage.numerical.mip + ....: == edge_connectivity(g, implementation="sage")) True Boost interface also works with directed graphs:: - sage: edge_connectivity(digraphs.Circuit(10), implementation="boost", vertices=True) + sage: edge_connectivity(digraphs.Circuit(10), implementation="boost", + ....: vertices=True) [1, [(0, 1)], [{0}, {1, 2, 3, 4, 5, 6, 7, 8, 9}]] However, the Boost algorithm is not reliable if the input is directed @@ -1128,7 +1131,7 @@ def edge_connectivity(G, Checking that the two implementations agree:: - sage: for i in range(10): + sage: for i in range(10): # needs sage.numerical.mip ....: g = graphs.RandomGNP(30, 0.3) ....: e1 = edge_connectivity(g, implementation="boost") ....: e2 = edge_connectivity(g, implementation="sage") diff --git a/src/sage/graphs/convexity_properties.pyx b/src/sage/graphs/convexity_properties.pyx index b2a96335d44..c422d0c3190 100644 --- a/src/sage/graphs/convexity_properties.pyx +++ b/src/sage/graphs/convexity_properties.pyx @@ -132,7 +132,7 @@ cdef class ConvexityProperties: sage: CP = ConvexityProperties(g) sage: CP.hull([1, 3]) [1, 2, 3] - sage: CP.hull_number() + sage: CP.hull_number() # needs sage.numerical.mip 3 TESTS:: @@ -410,10 +410,10 @@ cdef class ConvexityProperties: sage: from sage.graphs.convexity_properties import ConvexityProperties sage: g = graphs.PetersenGraph() sage: CP = ConvexityProperties(g) - sage: CP.hull_number() + sage: CP.hull_number() # needs sage.numerical.mip 3 - sage: generating_set = CP.hull_number(value_only=False) - sage: CP.hull(generating_set) + sage: generating_set = CP.hull_number(value_only=False) # needs sage.numerical.mip + sage: CP.hull(generating_set) # needs sage.numerical.mip [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] """ cdef int i diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 3070cb2f37f..ec2f608e28c 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -182,7 +182,7 @@ class DiGraphGenerators(): sage: L = list(digraphs(4, lambda G: G.size() <= 3)) sage: len(L) 20 - sage: graphs_list.show_graphs(L) # long time + sage: graphs_list.show_graphs(L) # long time # needs sage.plot Generate all digraphs with degree at most 2, up to 5 vertices:: @@ -371,7 +371,7 @@ def StronglyRegular(self, n): A Strongly Regular digraph satisfies the condition `AJ = JA = kJ` where `A` is the adjacency matrix:: - sage: # needs sage.modules + sage: # needs sage.combinat sage.modules sage: g = digraphs.StronglyRegular(7); g Strongly regular digraph: Digraph on 7 vertices sage: A = g.adjacency_matrix()*ones_matrix(7) @@ -383,7 +383,7 @@ def StronglyRegular(self, n): Wrong parameter:: - sage: digraphs.StronglyRegular(73) # needs sage.modules + sage: digraphs.StronglyRegular(73) # needs sage.combinat sage.modules Traceback (most recent call last): ... ValueError: strongly regular digraph with 73 vertices not yet implemented @@ -516,7 +516,7 @@ def RandomTournament(self, n): sage: T = digraphs.RandomTournament(10); T Random Tournament: Digraph on 10 vertices - sage: T.size() == binomial(10, 2) + sage: T.size() == binomial(10, 2) # needs sage.symbolic True sage: T.is_tournament() True @@ -1635,7 +1635,7 @@ def RandomSemiComplete(self, n): sage: SC = digraphs.RandomSemiComplete(10); SC Random Semi-Complete digraph: Digraph on 10 vertices - sage: SC.size() >= binomial(10, 2) + sage: SC.size() >= binomial(10, 2) # needs sage.symbolic True sage: digraphs.RandomSemiComplete(-1) Traceback (most recent call last): diff --git a/src/sage/graphs/distances_all_pairs.pyx b/src/sage/graphs/distances_all_pairs.pyx index 73bbd2c62d6..9445442f603 100644 --- a/src/sage/graphs/distances_all_pairs.pyx +++ b/src/sage/graphs/distances_all_pairs.pyx @@ -2294,7 +2294,7 @@ def szeged_index(G, algorithm=None): Check that both algorithms return same value:: - sage: # long time + sage: # long time, needs networkx sage: G = graphs.RandomBarabasiAlbert(100, 2) sage: a = szeged_index(G, algorithm='low') sage: b = szeged_index(G, algorithm='high') diff --git a/src/sage/graphs/domination.py b/src/sage/graphs/domination.py index 37416d428a8..0dcab74e90c 100644 --- a/src/sage/graphs/domination.py +++ b/src/sage/graphs/domination.py @@ -344,7 +344,7 @@ def dominating_sets(g, k=1, independent=False, total=False, connected=False, Minimum connected dominating sets of the Peterson graph:: sage: G = graphs.PetersenGraph() - sage: G.dominating_set(total=True, value_only=True) + sage: G.dominating_set(total=True, value_only=True) # needs sage.numerical.mip 4 sage: sorted(G.dominating_sets(k=1, connected=True)) [[0, 1, 2, 6], @@ -361,7 +361,8 @@ def dominating_sets(g, k=1, independent=False, total=False, connected=False, Subgraph induced by the dominating set is connected:: sage: G = graphs.PetersenGraph() - sage: all(G.subgraph(vertices=dom).is_connected() for dom in G.dominating_set(k=1, connected=True)) + sage: all(G.subgraph(vertices=dom).is_connected() + ....: for dom in G.dominating_set(k=1, connected=True)) True Minimum distance-k connected dominating sets of the Tietze graph:: @@ -375,7 +376,7 @@ def dominating_sets(g, k=1, independent=False, total=False, connected=False, TESTS:: sage: g = Graph([(0, 1)]) - sage: next(g.dominating_sets(k=-1)) # needs sage.numerical.mip + sage: next(g.dominating_sets(k=-1)) Traceback (most recent call last): ... ValueError: the domination distance must be a non-negative integer diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index 314d66aef43..5dfe78f01a8 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -43,7 +43,7 @@ def BullGraph(): sage: g = graphs.BullGraph(); g Bull graph: Graph on 5 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot The bull graph has 5 vertices and 5 edges. Its radius is 2, its diameter 3, and its girth 3. The bull graph is planar with chromatic @@ -66,10 +66,13 @@ def BullGraph(): `x` is a variable, `A` the adjacency matrix of the graph, and `I` the identity matrix of the same dimensions as `A`:: + sage: # needs sage.libs.flint sage: chrompoly = g.chromatic_polynomial() sage: x = chrompoly.parent()('x') sage: x * (x - 2) * (x - 1)^3 == chrompoly True + + sage: # needs sage.libs.flint sage.modules sage: charpoly = g.characteristic_polynomial() sage: M = g.adjacency_matrix(); M [0 1 1 0 0] @@ -79,7 +82,7 @@ def BullGraph(): [0 0 1 0 0] sage: Id = identity_matrix(ZZ, M.nrows()) sage: D = x*Id - M - sage: D.determinant() == charpoly + sage: D.determinant() == charpoly # needs sage.symbolic True sage: x * (x^2 - x - 3) * (x^2 + x - 1) == charpoly True @@ -108,7 +111,7 @@ def ButterflyGraph(): sage: G = graphs.ButterflyGraph(); G Butterfly graph: Graph on 5 vertices - sage: G.show() # long time + sage: G.show() # long time # needs sage.plot sage: G.is_planar() True sage: G.order() @@ -170,7 +173,7 @@ def CircularLadderGraph(n): Construct and show a circular ladder graph with 26 nodes:: sage: g = graphs.CircularLadderGraph(13) - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot Create several circular ladder graphs in a Sage graphics array:: @@ -212,7 +215,7 @@ def ClawGraph(): Show a Claw graph:: - sage: (graphs.ClawGraph()).show() # long time + sage: (graphs.ClawGraph()).show() # long time # needs sage.plot Inspect a Claw graph:: @@ -500,7 +503,7 @@ def CompleteBipartiteGraph(p, q, set_position=True): Notice here how the spring-layout tends to center the nodes of `n1`:: sage: spring_med.show() # long time # needs networkx - sage: posdict_med.show() # long time + sage: posdict_med.show() # long time # needs sage.plot View many complete bipartite graphs with a Sage Graphics Array, with this constructor (i.e., the position dictionary filled):: @@ -659,7 +662,7 @@ def DiamondGraph(): Construct and show a diamond graph:: sage: g = graphs.DiamondGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (0, 1), 1: (-1, 0), 2: (1, 0), 3: (0, -1)} edges = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3)] @@ -681,7 +684,7 @@ def GemGraph(): Construct and show a gem graph:: sage: g = graphs.GemGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (0.5, 0), 1: (0, 0.75), 2: (0.25, 1), 3: (0.75, 1), 4: (1, 0.75)} edges = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (2, 3), (3, 4)] @@ -703,7 +706,7 @@ def ForkGraph(): Construct and show a fork graph:: sage: g = graphs.ForkGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (0, 0), 1: (1, 0), 2: (0, 1), 3: (1, 1), 4: (0, 2)} edges = [(0, 2), (2, 3), (3, 1), (2, 4)] @@ -723,7 +726,7 @@ def DartGraph(): Construct and show a dart graph:: sage: g = graphs.DartGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (0, 1), 1: (-1, 0), 2: (1, 0), 3: (0, -1), 4: (0, 0)} edges = [(0, 1), (0, 2), (1, 4), (2, 4), (0, 4), (3, 4)] @@ -748,7 +751,7 @@ def EmptyGraph(): sage: empty1 = graphs.EmptyGraph() sage: empty1.add_vertex() 0 - sage: empty1.show() # long time + sage: empty1.show() # long time # needs sage.plot Use for loops to build a graph from an empty graph:: @@ -764,7 +767,7 @@ def EmptyGraph(): ....: empty2.add_edge(i,i+1) # add edges {[0:1],[1:2],[2:3]} sage: for i in range(1, 4): ....: empty2.add_edge(4,i) # add edges {[1:4],[2:4],[3:4]} - sage: empty2.show() # long time + sage: empty2.show() # long time # needs sage.plot """ return Graph(sparse=True) @@ -896,7 +899,7 @@ def Grid2dGraph(p, q, set_positions=True): Construct and show a grid 2d graph Rows = `5`, Columns = `7`:: sage: g = graphs.Grid2dGraph(5,7) - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot TESTS: @@ -950,14 +953,14 @@ def GridGraph(dim_list): EXAMPLES:: sage: G = graphs.GridGraph([2,3,4]) - sage: G.show() # long time + sage: G.show() # long time # needs sage.plot :: sage: C = graphs.CubeGraph(4) sage: G = graphs.GridGraph([2,2,2,2]) - sage: C.show() # long time - sage: G.show() # long time + sage: C.show() # long time # needs sage.plot + sage: G.show() # long time # needs sage.plot TESTS: @@ -1064,7 +1067,7 @@ def HouseGraph(): Construct and show a house graph:: sage: g = graphs.HouseGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (-1, 0), 1: (1, 0), 2: (-1, 1), 3: (1, 1), 4: (0, 2)} edges = [(0, 1), (0, 2), (1, 3), (2, 3), (2, 4), (3, 4)] @@ -1092,7 +1095,7 @@ def HouseXGraph(): Construct and show a house X graph:: sage: g = graphs.HouseXGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ pos_dict = {0: (-1, 0), 1: (1, 0), 2: (-1, 1), 3: (1, 1), 4: (0, 2)} edges = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3), (2, 4), (3, 4)] @@ -1116,7 +1119,7 @@ def LadderGraph(n): Construct and show a ladder graph with 14 nodes:: sage: g = graphs.LadderGraph(7) - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot Create several ladder graphs in a Sage graphics array:: @@ -1179,26 +1182,26 @@ def PathGraph(n, pos=None): :: sage: p = graphs.PathGraph(10) - sage: p.show() # long time + sage: p.show() # long time # needs sage.plot 'circle': `10 < n < 41` :: sage: q = graphs.PathGraph(25) - sage: q.show() # long time + sage: q.show() # long time # needs sage.plot 'line': `n \geq 41` :: sage: r = graphs.PathGraph(55) - sage: r.show() # long time + sage: r.show() # long time # needs sage.plot Override the default drawing:: sage: s = graphs.PathGraph(5,'circle') - sage: s.show() # long time + sage: s.show() # long time # needs sage.plot """ G = Graph(n, name="Path graph") diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py index bf1aa04e933..1bfe55f0f54 100644 --- a/src/sage/graphs/generators/classical_geometries.py +++ b/src/sage/graphs/generators/classical_geometries.py @@ -1045,7 +1045,7 @@ def T2starGeneralizedQuadrangleGraph(q, dual=False, hyperoval=None, field=None, using the built-in construction:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: g = graphs.T2starGeneralizedQuadrangleGraph(4); g T2*(O,4); GQ(3, 5): Graph on 64 vertices sage: g.is_strongly_regular(parameters=True) @@ -1057,7 +1057,7 @@ def T2starGeneralizedQuadrangleGraph(q, dual=False, hyperoval=None, field=None, supplying your own hyperoval:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: F = GF(4,'b') sage: O = [vector(F,(0,0,0,1)),vector(F,(0,0,1,0))] + [vector(F, (0,1,x^2,x)) ....: for x in F] @@ -1068,7 +1068,7 @@ def T2starGeneralizedQuadrangleGraph(q, dual=False, hyperoval=None, field=None, TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: F = GF(4,'b') # repeating a point... sage: O = [vector(F,(0,1,0,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F] sage: graphs.T2starGeneralizedQuadrangleGraph(4, hyperoval=O, field=F) @@ -1168,21 +1168,23 @@ def HaemersGraph(q, hyperoval=None, hyperoval_matching=None, field=None, check_h using the built-in constructions:: - sage: g = graphs.HaemersGraph(4); g # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings + sage: g = graphs.HaemersGraph(4); g Haemers(4): Graph on 96 vertices - sage: g.is_strongly_regular(parameters=True) # needs sage.rings.finite_rings + sage: g.is_strongly_regular(parameters=True) (96, 19, 2, 4) supplying your own hyperoval_matching:: - sage: g = graphs.HaemersGraph(4, hyperoval_matching=((0,5),(1,4),(2,3))); g # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings + sage: g = graphs.HaemersGraph(4, hyperoval_matching=((0,5),(1,4),(2,3))); g Haemers(4): Graph on 96 vertices - sage: g.is_strongly_regular(parameters=True) # needs sage.rings.finite_rings + sage: g.is_strongly_regular(parameters=True) (96, 19, 2, 4) TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: F = GF(4,'b') # repeating a point... sage: O = [vector(F,(0,1,0,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F] sage: graphs.HaemersGraph(4, hyperoval=O, field=F) @@ -1392,7 +1394,7 @@ def Nowhere0WordsTwoWeightCodeGraph(q, hyperoval=None, field=None, check_hyperov using the built-in construction:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: g = graphs.Nowhere0WordsTwoWeightCodeGraph(8); g Nowhere0WordsTwoWeightCodeGraph(8): Graph on 196 vertices sage: g.is_strongly_regular(parameters=True) @@ -1403,7 +1405,7 @@ def Nowhere0WordsTwoWeightCodeGraph(q, hyperoval=None, field=None, check_hyperov supplying your own hyperoval:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: F = GF(8) sage: O = [vector(F,(0,0,1)),vector(F,(0,1,0))] + [vector(F, (1,x^2,x)) ....: for x in F] @@ -1414,7 +1416,7 @@ def Nowhere0WordsTwoWeightCodeGraph(q, hyperoval=None, field=None, check_hyperov TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.combinat sage.rings.finite_rings sage: F = GF(8) # repeating a point... sage: O = [vector(F,(1,0,0)),vector(F,(0,1,0))]+[vector(F, (1,x^2,x)) for x in F] sage: graphs.Nowhere0WordsTwoWeightCodeGraph(8,hyperoval=O,field=F) diff --git a/src/sage/graphs/generators/degree_sequence.py b/src/sage/graphs/generators/degree_sequence.py index ed89ce43abc..f5e68d89c79 100644 --- a/src/sage/graphs/generators/degree_sequence.py +++ b/src/sage/graphs/generators/degree_sequence.py @@ -93,15 +93,15 @@ def DegreeSequenceBipartite(s1, s2): If we are given as sequences ``[2,2,2,2,2]`` and ``[5,5]`` we are given as expected the complete bipartite graph `K_{2,5}`:: - sage: g = graphs.DegreeSequenceBipartite([2,2,2,2,2],[5,5]) # needs sage.modules - sage: g.is_isomorphic(graphs.CompleteBipartiteGraph(5,2)) # needs sage.modules + sage: g = graphs.DegreeSequenceBipartite([2,2,2,2,2],[5,5]) # needs sage.combinat sage.modules + sage: g.is_isomorphic(graphs.CompleteBipartiteGraph(5,2)) # needs sage.combinat sage.modules True Some sequences being incompatible if, for example, their sums are different, the functions raises a ``ValueError`` when no graph corresponding to the degree sequences exists:: - sage: g = graphs.DegreeSequenceBipartite([2,2,2,2,1],[5,5]) # needs sage.modules + sage: g = graphs.DegreeSequenceBipartite([2,2,2,2,1],[5,5]) # needs sage.combinat sage.modules Traceback (most recent call last): ... ValueError: there exists no bipartite graph corresponding to the given degree sequences @@ -110,7 +110,7 @@ def DegreeSequenceBipartite(s1, s2): :trac:`12155`:: - sage: graphs.DegreeSequenceBipartite([2,2,2,2,2],[5,5]).complement() # needs sage.modules + sage: graphs.DegreeSequenceBipartite([2,2,2,2,2],[5,5]).complement() # needs sage.combinat sage.modules Graph on 7 vertices """ from sage.combinat.integer_vector import gale_ryser_theorem diff --git a/src/sage/graphs/generators/distance_regular.pyx b/src/sage/graphs/generators/distance_regular.pyx index b90795b86a1..f05e4d714f7 100644 --- a/src/sage/graphs/generators/distance_regular.pyx +++ b/src/sage/graphs/generators/distance_regular.pyx @@ -321,8 +321,8 @@ def LargeWittGraph(): EXAMPLES:: - sage: g = graphs.LargeWittGraph() # needs sage.modules - sage: g.is_distance_regular(True) # needs sage.modules + sage: g = graphs.LargeWittGraph() # needs sage.libs.pari sage.modules + sage: g.is_distance_regular(True) # needs sage.libs.pari sage.modules ([30, 28, 24, None], [None, 1, 3, 15]) REFERENCES: @@ -359,9 +359,10 @@ def TruncatedWittGraph(): EXAMPLES:: - sage: G = graphs.TruncatedWittGraph() # long time # needs sage.modules - sage: G.is_distance_regular(True) # long time (due to above) # needs sage.modules - ([15, 14, 12, None], [None, 1, 1, 9]) + sage: # long time, needs sage.libs.pari sage.modules + sage: G = graphs.TruncatedWittGraph() + sage: G.is_distance_regular(True) + ([15, 14, 12, None], [None, 1, 1, 9]) REFERENCES: @@ -388,9 +389,9 @@ def DoublyTruncatedWittGraph(): EXAMPLES:: - sage: G = graphs.DoublyTruncatedWittGraph() # needs sage.modules - sage: G.is_distance_regular(True) # needs sage.modules - ([7, 6, 4, 4, None], [None, 1, 1, 1, 6]) + sage: G = graphs.DoublyTruncatedWittGraph() # needs sage.libs.pari sage.modules + sage: G.is_distance_regular(True) # needs sage.libs.pari sage.modules + ([7, 6, 4, 4, None], [None, 1, 1, 1, 6]) REFERENCES: @@ -411,8 +412,9 @@ def distance_3_doubly_truncated_Golay_code_graph(): EXAMPLES:: - sage: G = graphs.distance_3_doubly_truncated_Golay_code_graph() # long time, needs sage.modules sage.rings.finite_rings - sage: G.is_distance_regular(True) # long time (due to above) # needs sage.modules sage.rings.finite_rings + sage: # long time, needs sage.modules sage.rings.finite_rings + sage: G = graphs.distance_3_doubly_truncated_Golay_code_graph() + sage: G.is_distance_regular(True) # long time (due to above) ([9, 8, 6, 3, None], [None, 1, 1, 3, 8]) ALGORITHM: @@ -446,8 +448,9 @@ def shortened_00_11_binary_Golay_code_graph(): EXAMPLES:: - sage: G = graphs.shortened_00_11_binary_Golay_code_graph() # long time (9 s), needs sage.modules sage.rings.finite_rings - sage: G.is_distance_regular(True) # long time # needs sage.modules sage.rings.finite_rings + sage: # long time, needs sage.modules sage.rings.finite_rings + sage: G = graphs.shortened_00_11_binary_Golay_code_graph() # 9 s + sage: G.is_distance_regular(True) ([21, 20, 16, 6, 2, 1, None], [None, 1, 2, 6, 16, 20, 21]) ALGORITHM: @@ -485,8 +488,9 @@ def shortened_000_111_extended_binary_Golay_code_graph(): EXAMPLES:: - sage: G = graphs.shortened_000_111_extended_binary_Golay_code_graph() # long time (25 s), needs sage.modules sage.rings.finite_rings - sage: G.is_distance_regular(True) # long time # needs sage.modules sage.rings.finite_rings + sage: # long time, needs sage.modules sage.rings.finite_rings + sage: G = graphs.shortened_000_111_extended_binary_Golay_code_graph() # 25 s + sage: G.is_distance_regular(True) ([21, 20, 16, 9, 2, 1, None], [None, 1, 2, 3, 16, 20, 21]) ALGORITHM: @@ -2143,7 +2147,7 @@ def graph_with_classical_parameters(int d, int b, alpha_in, beta_in, int gamma): Half 4 Cube: Graph on 8 vertices sage: graph_with_classical_parameters(3, 2, 0, 2, 9) # needs sage.libs.gap Symplectic Dual Polar Graph DSp(6, 2): Graph on 135 vertices - sage: graph_with_classical_parameters(3, 2, 2, 14, 7) # long time + sage: graph_with_classical_parameters(3, 2, 2, 14, 7) # long time # needs sage.symbolic Grassmann graph J_2(6, 3): Graph on 1395 vertices sage: graph_with_classical_parameters(3, -2, -2, 6, 6) # optional - gap_package_atlasrep internet Generalised hexagon of order (2, 8): Graph on 819 vertices diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index a5916a13b5c..85ea52a4571 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -614,7 +614,7 @@ def BarbellGraph(n1, n2): sage: g = graphs.BarbellGraph(9, 4); g Barbell graph: Graph on 22 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot An ``n1 >= 2``, ``n2 >= 0`` barbell graph has order ``2*n1 + n2``. It has the complete graph on ``n1`` vertices as a subgraph. It also has @@ -712,7 +712,7 @@ def LollipopGraph(n1, n2): sage: g = graphs.LollipopGraph(13,4); g Lollipop graph: Graph on 17 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot TESTS:: @@ -785,7 +785,7 @@ def TadpoleGraph(n1, n2): sage: g = graphs.TadpoleGraph(13, 4); g Tadpole graph: Graph on 17 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot TESTS:: @@ -877,7 +877,7 @@ def DipoleGraph(n): sage: g = graphs.DipoleGraph(13); g Dipole graph: Multi-graph on 2 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot TESTS:: @@ -935,7 +935,7 @@ def BubbleSortGraph(n): sage: g = graphs.BubbleSortGraph(4); g Bubble sort: Graph on 24 vertices - sage: g.plot() # long time + sage: g.plot() # long time # needs sage.plot Graphics object consisting of 61 graphics primitives The bubble sort graph on `n = 1` symbol is the trivial graph `K_1`:: @@ -1313,9 +1313,9 @@ def GoethalsSeidelGraph(k, r): EXAMPLES:: - sage: graphs.GoethalsSeidelGraph(3,3) # needs sage.modules + sage: graphs.GoethalsSeidelGraph(3,3) # needs sage.combinat sage.modules Graph on 28 vertices - sage: graphs.GoethalsSeidelGraph(3,3).is_strongly_regular(parameters=True) # needs sage.modules + sage: graphs.GoethalsSeidelGraph(3,3).is_strongly_regular(parameters=True) # needs sage.combinat sage.modules (28, 15, 6, 10) """ from sage.combinat.designs.bibd import balanced_incomplete_block_design @@ -2137,7 +2137,7 @@ def HyperStarGraph(n, k): sage: g = graphs.HyperStarGraph(6,3) sage: sorted(g.neighbors('011100')) ['101100', '110100', '111000'] - sage: g.plot() # long time + sage: g.plot() # long time # needs sage.plot Graphics object consisting of 51 graphics primitives TESTS:: @@ -2205,11 +2205,11 @@ def LCFGraph(n, shift_list, repeats): INPUT: - - ``n`` - the number of nodes. + - ``n`` -- the number of nodes. - - ``shift_list`` - a list of integer shifts mod n. + - ``shift_list`` -- a list of integer shifts mod `n`. - - ``repeats`` - the number of times to repeat the + - ``repeats`` -- the number of times to repeat the process. @@ -2406,7 +2406,7 @@ def NKStarGraph(n, k): EXAMPLES:: sage: g = graphs.NKStarGraph(4,2) - sage: g.plot() # long time + sage: g.plot() # long time # needs sage.plot Graphics object consisting of 31 graphics primitives REFERENCES: @@ -2465,7 +2465,7 @@ def NStarGraph(n): EXAMPLES:: sage: g = graphs.NStarGraph(4) - sage: g.plot() # long time + sage: g.plot() # long time # needs sage.plot Graphics object consisting of 61 graphics primitives REFERENCES: @@ -2639,7 +2639,7 @@ def SquaredSkewHadamardMatrixGraph(n): EXAMPLES:: - sage: # needs sage.modules + sage: # needs sage.combinat sage.modules sage: G = graphs.SquaredSkewHadamardMatrixGraph(4) sage: G.is_strongly_regular(parameters=True) (225, 112, 55, 56) @@ -2693,14 +2693,15 @@ def SwitchedSquaredSkewHadamardMatrixGraph(n): EXAMPLES:: - sage: g = graphs.SwitchedSquaredSkewHadamardMatrixGraph(4) # needs sage.modules - sage: g.is_strongly_regular(parameters=True) # needs sage.modules + sage: # needs sage.combinat sage.modules + sage: g = graphs.SwitchedSquaredSkewHadamardMatrixGraph(4) + sage: g.is_strongly_regular(parameters=True) (226, 105, 48, 49) sage: from sage.combinat.designs.twographs import twograph_descendant - sage: twograph_descendant(g, 0).is_strongly_regular(parameters=True) # needs sage.modules + sage: twograph_descendant(g, 0).is_strongly_regular(parameters=True) (225, 112, 55, 56) - sage: gc = g.complement() # needs sage.modules - sage: twograph_descendant(gc, 0).is_strongly_regular(parameters=True) # needs sage.modules + sage: gc = g.complement() + sage: twograph_descendant(gc, 0).is_strongly_regular(parameters=True) (225, 112, 55, 56) TESTS:: @@ -3840,22 +3841,26 @@ def MathonPseudocyclicMergingGraph(M, t): sage: from sage.graphs.generators.families import MathonPseudocyclicMergingGraph as mer sage: from sage.graphs.generators.smallgraphs import _EllipticLinesProjectivePlaneScheme as ES - sage: G = mer(ES(3), 0) # long time - sage: G.is_strongly_regular(parameters=True) # long time + + sage: # long time, needs sage.libs.gap + sage: G = mer(ES(3), 0) + sage: G.is_strongly_regular(parameters=True) (784, 243, 82, 72) - sage: G = mer(ES(3), 1) # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = mer(ES(3), 1) + sage: G.is_strongly_regular(parameters=True) (784, 270, 98, 90) - sage: G = mer(ES(3), 2) # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = mer(ES(3), 2) + sage: G.is_strongly_regular(parameters=True) (784, 297, 116, 110) - sage: G = mer(ES(2), 2) # needs sage.libs.gap + sage: G = mer(ES(2), 2) Traceback (most recent call last): ... AssertionError... - sage: M = ES(3) # needs sage.libs.gap - sage: M = [M[1],M[0],M[2],M[3]] # needs sage.libs.gap - sage: G = mer(M, 2) # needs sage.libs.gap + + sage: # needs sage.libs.gap + sage: M = ES(3) + sage: M = [M[1],M[0],M[2],M[3]] + sage: G = mer(M, 2) Traceback (most recent call last): ... AssertionError... @@ -3937,7 +3942,7 @@ def MathonPseudocyclicStronglyRegularGraph(t, G=None, L=None): [-4 -3 -2 2 3 4 -1 0 1] [-2 -4 -3 4 2 3 1 -1 0] - sage: # needs sage.modules sage.rings.finite_rings sage.groups sage.libs.gap + sage: # needs sage.groups sage.libs.gap sage.modules sage.rings.finite_rings sage: G.relabel(range(9)) sage: G3x3 = graphs.MathonPseudocyclicStronglyRegularGraph(2, G=G, L=L) sage: G3x3.is_strongly_regular(parameters=True) @@ -4113,27 +4118,27 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False): INPUT: - - ``n`` (integer)-- a prime power + - ``n`` (integer) -- a prime power - - ``d`` (integer)-- must be odd if `n` is odd + - ``d`` (integer) -- must be odd if `n` is odd - ``Phi`` is an optional parameter of the construction; it must be either - - 'fixed'-- this will generate fixed default `\Phi_i`, for `i \in M`, or + - ``'fixed'`` -- this will generate fixed default `\Phi_i`, for `i \in M`, or - - 'random'-- `\Phi_i` are generated at random, or + - ``'random'`` -- `\Phi_i` are generated at random, or - - A dictionary describing the functions `\Phi_i`; for `i \in M`, - Phi[(i, T)] in `M`, for each edge T of `L` on `i`. - Also, each `\Phi_i` must be injective. + - A dictionary describing the functions `\Phi_i`; for `i \in M`, + Phi[(i, T)] in `M`, for each edge T of `L` on `i`. + Also, each `\Phi_i` must be injective. - ``Sigma`` is an optional parameter of the construction; it must be either - - 'fixed'-- this will generate a fixed default `\Sigma`, or + - ``'fixed'`` -- this will generate a fixed default `\Sigma`, or - - 'random'-- `\Sigma` is generated at random. + - ``'random'`` -- `\Sigma` is generated at random. - - ``verbose`` (Boolean)-- default is False. If True, print progress information + - ``verbose`` (Boolean) -- default is ``False``. If ``True``, print progress information .. SEEALSO:: @@ -4146,12 +4151,12 @@ def MuzychukS6Graph(n, d, Phi='fixed', Sigma='fixed', verbose=False): EXAMPLES:: - sage: graphs.MuzychukS6Graph(3, 3).is_strongly_regular(parameters=True) # needs sage.modules sage.rings.finite_rings + sage: # needs sage.combinat sage.modules sage.rings.finite_rings + sage: graphs.MuzychukS6Graph(3, 3).is_strongly_regular(parameters=True) (378, 116, 34, 36) - sage: phi = {(2,(0,2)):0, (1,(1,3)):1, (0,(0,3)):1, (2,(1,2)):1, # needs sage.modules + sage: phi = {(2,(0,2)):0, (1,(1,3)):1, (0,(0,3)):1, (2,(1,2)):1, ....: (1,(1,2)):0, (0,(0,2)):0, (3,(0,3)):0, (3,(1,3)):1} - sage: graphs.MuzychukS6Graph(2, 2, # needs sage.modules sage.rings.finite_rings - ....: Phi=phi).is_strongly_regular(parameters=True) + sage: graphs.MuzychukS6Graph(2, 2, Phi=phi).is_strongly_regular(parameters=True) (16, 5, 0, 2) TESTS:: diff --git a/src/sage/graphs/generators/intersection.py b/src/sage/graphs/generators/intersection.py index 0de3715e0e1..0d19d30f9ea 100644 --- a/src/sage/graphs/generators/intersection.py +++ b/src/sage/graphs/generators/intersection.py @@ -464,20 +464,20 @@ def OrthogonalArrayBlockGraph(k, n, OA=None): But nevertheless isospectral:: - sage: g0.spectrum() # needs sage.modules + sage: g0.spectrum() # needs sage.modules sage.rings.number_field [9, 1, 1, 1, 1, 1, 1, 1, 1, 1, -3, -3, -3, -3, -3, -3] - sage: g1.spectrum() # needs sage.modules + sage: g1.spectrum() # needs sage.modules sage.rings.number_field [9, 1, 1, 1, 1, 1, 1, 1, 1, 1, -3, -3, -3, -3, -3, -3] Note that the graph ``g0`` is actually isomorphic to the affine polar graph `VO^+(4,2)`:: - sage: graphs.AffineOrthogonalPolarGraph(4,2,'+').is_isomorphic(g0) # needs sage.modules + sage: graphs.AffineOrthogonalPolarGraph(4,2,'+').is_isomorphic(g0) # needs sage.libs.gap sage.modules True TESTS:: - sage: G = graphs.OrthogonalArrayBlockGraph(4,6) # needs sage.modules + sage: G = graphs.OrthogonalArrayBlockGraph(4,6) # needs sage.modules sage.schemes Traceback (most recent call last): ... NotImplementedError: I don't know how to build an OA(4,6)! diff --git a/src/sage/graphs/generators/platonic_solids.py b/src/sage/graphs/generators/platonic_solids.py index 38e070a054a..d3bc60a9974 100644 --- a/src/sage/graphs/generators/platonic_solids.py +++ b/src/sage/graphs/generators/platonic_solids.py @@ -142,7 +142,7 @@ def OctahedralGraph(): Construct and show an Octahedral graph:: sage: g = graphs.OctahedralGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot Create several octahedral graphs in a Sage graphics array They will be drawn differently due to the use of the spring-layout algorithm:: diff --git a/src/sage/graphs/generators/random.py b/src/sage/graphs/generators/random.py index 5dab4071f49..d253633621c 100644 --- a/src/sage/graphs/generators/random.py +++ b/src/sage/graphs/generators/random.py @@ -69,7 +69,7 @@ def RandomGNP(n, p, seed=None, fast=True, algorithm='Sage'): We plot a random graph on 12 nodes with probability `p = .71`:: sage: gnp = graphs.RandomGNP(12,.71) - sage: gnp.show() # long time + sage: gnp.show() # long time # needs sage.plot We view many random graphs using a graphics array:: @@ -1359,7 +1359,7 @@ def RandomTree(n, seed=None): sage: G = graphs.RandomTree(10) sage: G.is_tree() True - sage: G.show() # long time + sage: G.show() # long time # needs sage.plot TESTS: diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index a090eb3f73d..a4f3e1c05ef 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -455,7 +455,7 @@ def Cell600(embedding=1): EXAMPLES:: - sage: # long time + sage: # long time, needs sage.rings.number_field sage: g = graphs.Cell600() sage: g.size() 720 @@ -531,7 +531,7 @@ def Cell120(): EXAMPLES:: - sage: # long time + sage: # long time, needs sage.rings.number_field sage: g = graphs.Cell120() sage: g.size() 1200 @@ -1066,7 +1066,7 @@ def BidiakisCube(): sage: g = graphs.BidiakisCube(); g Bidiakis cube: Graph on 12 vertices - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot sage: g.order() 12 sage: g.size() @@ -1297,7 +1297,7 @@ def BrinkmannGraph(): sage: G = graphs.BrinkmannGraph(); G Brinkmann graph: Graph on 21 vertices - sage: G.show() # long time + sage: G.show() # long time # needs sage.plot sage: G.order() 21 sage: G.size() @@ -1424,7 +1424,7 @@ def BuckyBall(): The Bucky Ball can also be created by extracting the 1-skeleton of the Bucky Ball polyhedron, but this is much slower:: - sage: # needs sage.geometry.polyhedron sage.rings.number_field + sage: # needs sage.geometry.polyhedron sage.groups sage.rings.number_field sage: g = polytopes.buckyball().vertex_graph() sage: g.remove_loops() sage: h = graphs.BuckyBall() @@ -2184,7 +2184,7 @@ def EllinghamHorton54Graph(): TESTS:: - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot """ edge_dict = { 0: [1, 11, 15], 1: [2, 47], 2: [3, 13], 3: [4, 8], 4: [5, 15], @@ -2425,7 +2425,7 @@ def FlowerSnark(): Now show it:: - sage: F.show() # long time + sage: F.show() # long time # needs sage.plot """ d = {0: [1, 14, 15], 1: [2, 11], 2: [3, 7], 3: [2, 4, 16], 4: [5, 14], 5: [6, 10], 6: [5, 7, 17], 8: [7, 9, 13], 9: [10, 18], 11: [10, 12], @@ -2844,7 +2844,7 @@ def HeawoodGraph(): Heawood graph: Graph on 14 vertices sage: H.graph6_string() 'MhEGHC@AI?_PC@_G_' - sage: (graphs.HeawoodGraph()).show() # long time + sage: (graphs.HeawoodGraph()).show() # long time # needs sage.plot TESTS:: @@ -3303,7 +3303,7 @@ def KrackhardtKiteGraph(): Construct and show a Krackhardt kite graph :: sage: g = graphs.KrackhardtKiteGraph() - sage: g.show() # long time + sage: g.show() # long time # needs sage.plot TESTS:: @@ -4534,7 +4534,7 @@ def TutteGraph(): 69 sage: g.is_planar() True - sage: g.vertex_connectivity() # long time + sage: g.vertex_connectivity() # long time # needs sage.numerical.mip 3 sage: g.girth() 4 @@ -4754,14 +4754,15 @@ def MathonStronglyRegularGraph(t): EXAMPLES:: + sage: # long time, needs sage.libs.gap sage: from sage.graphs.generators.smallgraphs import MathonStronglyRegularGraph - sage: G = MathonStronglyRegularGraph(0) # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = MathonStronglyRegularGraph(0) + sage: G.is_strongly_regular(parameters=True) (784, 243, 82, 72) TESTS:: - sage: # long time + sage: # long time, needs sage.libs.gap sage: G = graphs.MathonStronglyRegularGraph(1) sage: G.is_strongly_regular(parameters=True) (784, 270, 98, 90) @@ -4789,12 +4790,12 @@ def JankoKharaghaniGraph(v): EXAMPLES:: - sage: g = graphs.JankoKharaghaniGraph(936) # long time - sage: g.is_strongly_regular(parameters=True) # long time + sage: g = graphs.JankoKharaghaniGraph(936) # long time # needs sage.libs.pari + sage: g.is_strongly_regular(parameters=True) # long time # needs sage.libs.pari (936, 375, 150, 150) - sage: g = graphs.JankoKharaghaniGraph(1800) # not tested (30s) - sage: g.is_strongly_regular(parameters=True) # not tested (30s) + sage: g = graphs.JankoKharaghaniGraph(1800) # not tested (30s) + sage: g.is_strongly_regular(parameters=True) # not tested (30s) (1800, 1029, 588, 588) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF @@ -4881,8 +4882,8 @@ def JankoKharaghaniTonchevGraph(): EXAMPLES:: - sage: Gamma=graphs.JankoKharaghaniTonchevGraph() # long time - sage: Gamma.is_strongly_regular(parameters=True) # long time + sage: Gamma = graphs.JankoKharaghaniTonchevGraph() # long time # needs sage.libs.gap + sage: Gamma.is_strongly_regular(parameters=True) # long time # needs sage.libs.gap (324, 153, 72, 72) """ from sage.misc.misc_c import prod diff --git a/src/sage/graphs/generators/world_map.py b/src/sage/graphs/generators/world_map.py index 76c32335f60..f131aa446e2 100644 --- a/src/sage/graphs/generators/world_map.py +++ b/src/sage/graphs/generators/world_map.py @@ -48,7 +48,7 @@ def AfricaMap(continental=False, year=2018): TESTS:: - sage: Africa.plot() # long time + sage: Africa.plot() # long time # needs sage.plot Graphics object consisting of 159 graphics primitives """ if year != 2018: diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 66703a0f7c1..9b7bc147510 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -959,7 +959,7 @@ def _matrix_(self, R=None, vertices=None): [1 1 0 0 0] [1 1 0 0 0] [1 1 0 0 0] - sage: factor(m.charpoly()) # needs sage.modules + sage: factor(m.charpoly()) # needs sage.libs.pari sage.modules x^3 * (x^2 - 6) """ return self.am(vertices=vertices, base_ring=R) @@ -1995,7 +1995,7 @@ def adjacency_matrix(self, sparse=None, vertices=None, *, base_ring=None, **kwds A different matrix implementation:: - sage: graphs.PathGraph(5).adjacency_matrix(sparse=False, # needs sage.modules + sage: graphs.PathGraph(5).adjacency_matrix(sparse=False, # needs numpy sage.modules ....: implementation='numpy') [0 1 0 0 0] [1 0 1 0 0] @@ -4830,7 +4830,7 @@ def min_spanning_tree(self, [(0, 2, 10), (1, 2, 1)] sage: Graph(g.min_spanning_tree(algorithm='Prim_Boost', weight_function=weight)).edges(sort=True) [(0, 2, 10), (1, 2, 1)] - sage: Graph(g.min_spanning_tree(algorithm='NetworkX', weight_function=weight)).edges(sort=True) # needs networkx + sage: Graph(g.min_spanning_tree(algorithm='NetworkX', weight_function=weight)).edges(sort=True) # needs networkx [(0, 2, 10), (1, 2, 1)] If the graph is directed, it is transformed into an undirected graph:: @@ -6811,13 +6811,13 @@ def steiner_tree(self, vertices, weighted=False, solver=None, verbose=0, sage: g = graphs.RandomGNP(30, .5) sage: first5 = g.vertices(sort=True)[:5] - sage: st = g.steiner_tree(first5) - sage: st.is_tree() + sage: st = g.steiner_tree(first5) # needs sage.numerical.mip + sage: st.is_tree() # needs sage.numerical.mip True And all the 5 vertices are contained in this tree :: - sage: all(v in st for v in first5) + sage: all(v in st for v in first5) # needs sage.numerical.mip True An exception is raised when the problem is impossible, i.e. if the @@ -7024,7 +7024,7 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None sage: d6 += r'@ADA@AAg?GAQW?[aIaSwHYcD@qQb@Dd?\hJTI@OHlJ_?C_OEIKoeC' sage: d6 += r'R@_BC?Q??YBFosqITEA?IvCU_' sage: G = DiGraph(d6, format='dig6') - sage: G.edge_connectivity() + sage: G.edge_connectivity() # needs sage.numerical.mip 5 sage: G.edge_disjoint_spanning_trees(5) # long time # needs sage.numerical.mip [Digraph on 28 vertices, @@ -7055,11 +7055,12 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None Choice of the algorithm:: - sage: Graph().edge_disjoint_spanning_trees(0, algorithm=None) # needs sage.numerical.mip + sage: # needs sage.numerical.mip + sage: Graph().edge_disjoint_spanning_trees(0, algorithm=None) [] sage: Graph().edge_disjoint_spanning_trees(0, algorithm="Roskind-Tarjan") [] - sage: Graph().edge_disjoint_spanning_trees(0, algorithm="MILP") # needs sage.numerical.mip + sage: Graph().edge_disjoint_spanning_trees(0, algorithm="MILP") [] sage: Graph().edge_disjoint_spanning_trees(0, algorithm="foo") Traceback (most recent call last): @@ -7067,7 +7068,7 @@ def edge_disjoint_spanning_trees(self, k, algorithm=None, root=None, solver=None ValueError: algorithm must be None, "Rosking-Tarjan" or "MILP" for undirected graphs sage: DiGraph().edge_disjoint_spanning_trees(0, algorithm=None) [] - sage: DiGraph().edge_disjoint_spanning_trees(0, algorithm="MILP") # needs sage.numerical.mip + sage: DiGraph().edge_disjoint_spanning_trees(0, algorithm="MILP") [] sage: DiGraph().edge_disjoint_spanning_trees(0, algorithm="foo") Traceback (most recent call last): @@ -7284,7 +7285,8 @@ def edge_cut(self, s, t, value_only=True, use_edge_labels=False, vertices=False, The two sides of the edge cut are obviously shorter paths:: - sage: value,edges,[set1,set2] = g.edge_cut(0, 14, use_edge_labels=True, vertices=True) + sage: value, edges, [set1, set2] = g.edge_cut(0, 14, use_edge_labels=True, + ....: vertices=True) sage: g.subgraph(set1).is_isomorphic(graphs.PathGraph(len(set1))) True sage: g.subgraph(set2).is_isomorphic(graphs.PathGraph(len(set2))) @@ -7307,7 +7309,7 @@ def edge_cut(self, s, t, value_only=True, use_edge_labels=False, vertices=False, sage: g = graphs.RandomGNP(20,.3) sage: for u,v in g.edges(sort=True, labels=False): ....: g.set_edge_label(u,v,round(random(),5)) - sage: g.edge_cut(0, 1, algorithm="FF") == g.edge_cut(0, 1, algorithm="LP") + sage: g.edge_cut(0, 1, algorithm="FF") == g.edge_cut(0, 1, algorithm="LP") # needs sage.numerical.mip True sage: g.edge_cut(0, 1, algorithm="FF") == g.edge_cut(0, 1, algorithm="igraph") # optional - python_igraph True @@ -7315,7 +7317,7 @@ def edge_cut(self, s, t, value_only=True, use_edge_labels=False, vertices=False, Rounded return value when using the LP method:: sage: g = graphs.PappusGraph() - sage: g.edge_cut(1, 2, value_only=True, algorithm="LP") + sage: g.edge_cut(1, 2, value_only=True, algorithm="LP") # needs sage.numerical.mip 3 :trac:`12797`:: @@ -7326,7 +7328,7 @@ def edge_cut(self, s, t, value_only=True, use_edge_labels=False, vertices=False, sage: G = DiGraph([(0, 3, 1), (0, 4, 1), (2, 1, 1), (3, 2, 1), (4, 2, 1)]) sage: G.edge_cut(0, 1, value_only=False, use_edge_labels=True) [1, [(2, 1, 1)]] - sage: G.edge_cut(0, 1, value_only=False, use_edge_labels=True, algorithm='LP') + sage: G.edge_cut(0, 1, value_only=False, use_edge_labels=True, algorithm='LP') # needs sage.numerical.mip (1, [(2, 1)]) """ self._scream_if_not_simple(allow_loops=True) @@ -9519,8 +9521,8 @@ def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, sage: for u, v in g.edge_iterator(labels=False): ....: g.set_edge_label(u, v, round(random(), 5)) sage: flow_ff = g.flow(0, 1, algorithm="FF") - sage: flow_lp = g.flow(0, 1, algorithm="LP") - sage: abs(flow_ff - flow_lp) < 0.01 + sage: flow_lp = g.flow(0, 1, algorithm="LP") # needs sage.numerical.mip + sage: abs(flow_ff - flow_lp) < 0.01 # needs sage.numerical.mip True sage: flow_igraph = g.flow(0, 1, algorithm="igraph") # optional python_igraph sage: abs(flow_ff - flow_igraph) < 0.00001 # optional python_igraph @@ -12365,7 +12367,7 @@ def set_edge_label(self, u, v, l): ....: 9: [6, 11], 10: [9, 1], 11: [10, 6], 12: [13, 6], ....: 13: [16, 2], 14: [10, -6], 15: [0, -10], 16: [14, -6], ....: 17: [16, -10], 18: [6, -4]} - sage: SD.plot(pos=posn, vertex_size=400, vertex_colors={'#FFFFFF':list(range(1,19))}, edge_labels=True).show() # long time + sage: SD.plot(pos=posn, vertex_size=400, vertex_colors={'#FFFFFF':list(range(1,19))}, edge_labels=True).show() # long time, needs sage.plot :: @@ -15616,7 +15618,7 @@ def distance(self, u, v, by_weight=False, weight_function=None, check_weight=Tru sage: G.distance(0,1) +Infinity sage: G = Graph({ 0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2}}, sparse = True) - sage: G.plot(edge_labels=True).show() # long time + sage: G.plot(edge_labels=True).show() # long time # needs sage.plot sage: G.distance(0, 3) 2 sage: G.distance(0, 3, by_weight=True) @@ -16627,7 +16629,7 @@ def shortest_path(self, u, v, by_weight=False, algorithm=None, [] sage: G = Graph({0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2}}, ....: sparse=True) - sage: G.plot(edge_labels=True).show() # long time + sage: G.plot(edge_labels=True).show() # long time # needs sage.plot sage: G.shortest_path(0, 3) [0, 4, 3] sage: G.shortest_path(0, 3, by_weight=True) @@ -16675,7 +16677,7 @@ def shortest_path(self, u, v, by_weight=False, algorithm=None, sage: G = Graph() sage: G.add_vertices([1, 2]) sage: algs = ['BFS', 'BFS_Bid', 'Dijkstra_Bid', 'Bellman-Ford_Boost'] - sage: algs += ['Dijkstra_NetworkX', 'Dijkstra_Bid_NetworkX'] # needs networkx + sage: import networkx; algs += ['Dijkstra_NetworkX', 'Dijkstra_Bid_NetworkX'] # needs networkx sage: all(G.shortest_path(1, 2, algorithm=alg) == [] ....: for alg in algs) True @@ -16813,7 +16815,7 @@ def shortest_path_length(self, u, v, by_weight=False, algorithm=None, +Infinity sage: G = Graph({0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2}}, ....: sparse=True) - sage: G.plot(edge_labels=True).show() # long time + sage: G.plot(edge_labels=True).show() # long time # needs sage.plot sage: G.shortest_path_length(0, 3) 2 sage: G.shortest_path_length(0, 3, by_weight=True) @@ -16864,7 +16866,7 @@ def shortest_path_length(self, u, v, by_weight=False, algorithm=None, sage: G = Graph() sage: G.add_vertices([1, 2]) sage: algs = ['BFS', 'BFS_Bid', 'Dijkstra_Bid', 'Bellman-Ford_Boost'] - sage: algs += ['Dijkstra_NetworkX', 'Dijkstra_Bid_NetworkX'] # needs networkx + sage: import networkx; algs += ['Dijkstra_NetworkX', 'Dijkstra_Bid_NetworkX'] # needs networkx sage: all(G.shortest_path_length(1, 2, algorithm=alg) == Infinity ....: for alg in algs) True @@ -17120,7 +17122,7 @@ def shortest_paths(self, u, by_weight=False, algorithm=None, 9: [0, 10, 9], 10: [0, 10], 11: [0, 10, 11], 18: [0, 19, 18], 19: [0, 19]} sage: G = Graph( { 0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2} }, sparse=True) - sage: G.plot(edge_labels=True).show() # long time + sage: G.plot(edge_labels=True).show() # long time # needs sage.plot sage: G.shortest_paths(0, by_weight=True) {0: [0], 1: [0, 1], 2: [0, 1, 2], 3: [0, 1, 2, 3], 4: [0, 4]} @@ -17528,8 +17530,8 @@ def shortest_path_all_pairs(self, by_weight=False, algorithm=None, Some standard examples (see :meth:`~GenericGraph.shortest_paths` for more examples on how to use the input variables):: - sage: G = Graph( { 0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2} }, sparse=True) - sage: G.plot(edge_labels=True).show() # long time + sage: G = Graph({0: {1: 1}, 1: {2: 1}, 2: {3: 1}, 3: {4: 2}, 4: {0: 2}}, sparse=True) + sage: G.plot(edge_labels=True).show() # long time # needs sage.plot sage: dist, pred = G.shortest_path_all_pairs(by_weight = True) sage: dist {0: {0: 0, 1: 1, 2: 2, 3: 3, 4: 2}, @@ -19059,7 +19061,7 @@ def tensor_product(self, other): Graph on 10 vertices sage: T.size() 10 - sage: T.plot() # long time + sage: T.plot() # long time # needs sage.plot Graphics object consisting of 21 graphics primitives :: @@ -19070,7 +19072,7 @@ def tensor_product(self, other): Graph on 200 vertices sage: T.size() 900 - sage: T.plot() # long time + sage: T.plot() # long time # needs sage.plot Graphics object consisting of 1101 graphics primitives TESTS: @@ -19140,7 +19142,7 @@ def lexicographic_product(self, other): sage: C = graphs.CycleGraph(5) sage: L = C.lexicographic_product(Z); L Graph on 10 vertices - sage: L.plot() # long time + sage: L.plot() # long time # needs sage.plot Graphics object consisting of 36 graphics primitives :: @@ -19149,7 +19151,7 @@ def lexicographic_product(self, other): sage: P = graphs.PetersenGraph() sage: L = D.lexicographic_product(P); L Graph on 200 vertices - sage: L.plot() # long time + sage: L.plot() # long time # needs sage.plot Graphics object consisting of 3501 graphics primitives TESTS: @@ -19220,7 +19222,7 @@ def strong_product(self, other): sage: C = graphs.CycleGraph(5) sage: S = C.strong_product(Z); S Graph on 10 vertices - sage: S.plot() # long time + sage: S.plot() # long time # needs sage.plot Graphics object consisting of 36 graphics primitives :: @@ -19229,7 +19231,7 @@ def strong_product(self, other): sage: P = graphs.PetersenGraph() sage: S = D.strong_product(P); S Graph on 200 vertices - sage: S.plot() # long time + sage: S.plot() # long time # needs sage.plot Graphics object consisting of 1701 graphics primitives TESTS: @@ -19300,7 +19302,7 @@ def disjunctive_product(self, other): sage: Z = graphs.CompleteGraph(2) sage: D = Z.disjunctive_product(Z); D Graph on 4 vertices - sage: D.plot() # long time + sage: D.plot() # long time # needs sage.plot Graphics object consisting of 11 graphics primitives :: @@ -19308,7 +19310,7 @@ def disjunctive_product(self, other): sage: C = graphs.CycleGraph(5) sage: D = C.disjunctive_product(Z); D Graph on 10 vertices - sage: D.plot() # long time + sage: D.plot() # long time # needs sage.plot Graphics object consisting of 46 graphics primitives TESTS: @@ -20915,7 +20917,7 @@ def plot(self, **options): The following illustrates the format of a position dictionary:: - sage: G.get_pos() # currently random across platforms, see #9593 # needs sage.plot + sage: G.get_pos() # currently random across platforms, see #9593 # needs sage.plot {0: [1.17..., -0.855...], 1: [1.81..., -0.0990...], 2: [1.35..., 0.184...], @@ -23224,7 +23226,7 @@ def automorphism_group(self, partition=None, verbosity=0, sage: G1 = Graph(':H`ECw@HGXGAGUG`e') sage: G = G1.automorphism_group() # needs sage.groups - sage: G.subgroups() + sage: G.subgroups() # needs sage.groups [Subgroup generated by [()] of (Permutation Group with generators [(0,7)(1,4)(2,3)(6,8)]), Subgroup generated by [(0,7)(1,4)(2,3)(6,8)] of (Permutation Group with generators [(0,7)(1,4)(2,3)(6,8)])] @@ -23568,7 +23570,7 @@ def is_isomorphic(self, other, certificate=False, verbosity=0, edge_labels=False sage: position_E = {} sage: for vert in position_D: ....: position_E[b[vert]] = position_D[vert] - sage: graphics_array([D.plot(pos=position_D), E.plot(pos=position_E)]).show() # long time + sage: graphics_array([D.plot(pos=position_D), E.plot(pos=position_E)]).show() # long time, needs sage.plot :: @@ -24006,7 +24008,7 @@ class by some canonization function `c`. If `G` and `H` are graphs, ....: [(0,1), (0,2), (1,2)], ....: [(0,1), (0,2), (0,3)]] sage: algos = ['sage'] - sage: algos.append('bliss') # optional - bliss + sage: import sage.graphs.bliss; algos.append('bliss') # optional - bliss sage: S = Set([0,1,2]) sage: for (algo, edges) in product(algos, edges_list): # needs sage.combinat ....: L = cartesian_product([S] * len(edges)) @@ -24550,7 +24552,7 @@ def katz_centrality(self, alpha, u=None): all 4 vertices have the same centrality) :: sage: G = graphs.CycleGraph(4) - sage: G.katz_centrality(1/20) # needs sage.modules + sage: G.katz_centrality(1/20) # needs sage.modules sage.rings.number_field {0: 1/9, 1: 1/9, 2: 1/9, 3: 1/9} Note that in the below example the nodes having indegree `0` also have @@ -24559,7 +24561,7 @@ def katz_centrality(self, alpha, u=None): sage: G = DiGraph({1: [10], 2:[10,11], 3:[10,11], 4:[], 5:[11, 4], 6:[11], ....: 7:[10,11], 8:[10,11], 9:[10], 10:[11, 5, 8], 11:[6]}) - sage: G.katz_centrality(.85) # rel tol 1e-14 # needs sage.modules + sage: G.katz_centrality(.85) # rel tol 1e-14 # needs sage.modules sage.rings.number_field {1: 0.000000000000000, 2: 0.000000000000000, 3: 0.000000000000000, @@ -24580,7 +24582,7 @@ def katz_centrality(self, alpha, u=None): TESTS:: - sage: # needs sage.modules + sage: # needs sage.modules sage.rings.number_field sage: graphs.PathGraph(3).katz_centrality(1/20) {0: 11/199, 1: 21/199, 2: 11/199} sage: graphs.PathGraph(4).katz_centrality(1/20) diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index fe02be46c77..a7bb3eb810a 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -783,10 +783,10 @@ class Graph(GenericGraph): #. A Seidel adjacency matrix:: - sage: from sage.combinat.matrices.hadamard_matrix import ( # needs sage.modules + sage: from sage.combinat.matrices.hadamard_matrix import ( # needs sage.combinat sage.modules ....: regular_symmetric_hadamard_matrix_with_constant_diagonal as rshcd) - sage: m = rshcd(16,1) - matrix.identity(16) # needs sage.modules - sage: Graph(m, # needs sage.modules + sage: m = rshcd(16,1) - matrix.identity(16) # needs sage.combinat sage.modules + sage: Graph(m, # needs sage.combinat sage.modules ....: format="seidel_adjacency_matrix").is_strongly_regular(parameters=True) (16, 6, 2, 2) @@ -2463,7 +2463,7 @@ def is_triangle_free(self, algorithm='dense_graph', certificate=False): Comparison of algorithms:: - sage: for i in range(10): # long time + sage: for i in range(10): # long time # needs networkx ....: G = graphs.RandomBarabasiAlbert(50,2) ....: bm = G.is_triangle_free(algorithm='matrix') ....: bb = G.is_triangle_free(algorithm='bitset') @@ -3334,15 +3334,15 @@ def bounded_outdegree_orientation(self, bound, solver=None, verbose=False, divided by 2. Anything less, though, is impossible. sage: g = graphs.RandomGNP(40, .4) - sage: mad = g.maximum_average_degree() + sage: mad = g.maximum_average_degree() # needs sage.numerical.mip Hence this is possible :: - sage: d = g.bounded_outdegree_orientation(integer_ceil(mad/2)) + sage: d = g.bounded_outdegree_orientation(integer_ceil(mad/2)) # needs sage.numerical.mip While this is not:: - sage: try: + sage: try: # needs sage.numerical.mip ....: g.bounded_outdegree_orientation(integer_ceil(mad/2-1)) ....: print("Error") ....: except ValueError: @@ -3746,7 +3746,7 @@ def chromatic_number(self, algorithm="DLX", solver=None, verbose=0, 3 sage: G.chromatic_number(algorithm="MILP") 3 - sage: G.chromatic_number(algorithm="CP") + sage: G.chromatic_number(algorithm="CP") # needs sage.libs.flint 3 sage: G.chromatic_number(algorithm="parallel") 3 @@ -3786,7 +3786,7 @@ def chromatic_number(self, algorithm="DLX", solver=None, verbose=0, 0 sage: G.chromatic_number(algorithm="MILP") 0 - sage: G.chromatic_number(algorithm="CP") + sage: G.chromatic_number(algorithm="CP") # needs sage.libs.flint 0 sage: G.chromatic_number(algorithm="parallel") 0 @@ -3801,7 +3801,7 @@ def chromatic_number(self, algorithm="DLX", solver=None, verbose=0, sage: G = graphs.RandomGNP(15, .2) sage: algorithms = ['DLX', 'MILP', 'CP', 'parallel'] - sage: len(set([G.chromatic_number(algorithm=algo) for algo in algorithms])) == 1 + sage: len(set([G.chromatic_number(algorithm=algo) for algo in algorithms])) == 1 # needs sage.libs.flint True """ self._scream_if_not_simple(allow_multiple_edges=True) @@ -4166,7 +4166,7 @@ def matching(self, value_only=False, algorithm="Edmonds", Same test with the Linear Program formulation:: sage: g = graphs.PappusGraph() - sage: g.matching(algorithm="LP", value_only=True) + sage: g.matching(algorithm="LP", value_only=True) # needs sage.numerical.mip 9 .. PLOT:: @@ -4182,7 +4182,7 @@ def matching(self, value_only=False, algorithm="Edmonds", sage: g = Graph([(0,1,0), (1,2,999), (2,3,-5)]) sage: sorted(g.matching()) # needs sage.networkx [(0, 1, 0), (2, 3, -5)] - sage: sorted(g.matching(algorithm="LP")) + sage: sorted(g.matching(algorithm="LP")) # needs sage.numerical.mip [(0, 1, 0), (2, 3, -5)] When ``use_edge_labels`` is set to ``True``, with Edmonds' algorithm and @@ -4191,7 +4191,7 @@ def matching(self, value_only=False, algorithm="Edmonds", sage: g = Graph([(0,1,0), (1,2,999), (2,3,-5)]) sage: g.matching(use_edge_labels=True) # needs sage.networkx [(1, 2, 999)] - sage: g.matching(algorithm="LP", use_edge_labels=True) + sage: g.matching(algorithm="LP", use_edge_labels=True) # needs sage.numerical.mip [(1, 2, 999)] With loops and multiedges:: @@ -5088,18 +5088,20 @@ def convexity_properties(self): .. NOTE:: - If you want to compute many convex hulls, keep this object in memory - ! When it is created, it builds a table of useful information to + If you want to compute many convex hulls, keep this object in memory! + When it is created, it builds a table of useful information to compute convex hulls. As a result :: + sage: # needs sage.numerical.mip sage: g = graphs.PetersenGraph() sage: g.convexity_properties().hull([1, 3]) [1, 2, 3] sage: g.convexity_properties().hull([3, 7]) [2, 3, 7] - Is a terrible waste of computations, while :: + is a terrible waste of computations, while :: + sage: # needs sage.numerical.mip sage: g = graphs.PetersenGraph() sage: CP = g.convexity_properties() sage: CP.hull([1, 3]) @@ -5107,7 +5109,7 @@ def convexity_properties(self): sage: CP.hull([3, 7]) [2, 3, 7] - Makes perfect sense. + makes perfect sense. """ from sage.graphs.convexity_properties import ConvexityProperties return ConvexityProperties(self) @@ -5846,7 +5848,7 @@ def distance_graph(self, dist): The graph of eight-bit strings, adjacent if different in an odd number of bits:: - sage: # long time + sage: # long time, needs sage.symbolic sage: G = graphs.CubeGraph(8) sage: H = G.distance_graph([1,3,5,7]) sage: degrees = [0]*sum([binomial(8,j) for j in [1,3,5,7]]) @@ -7500,7 +7502,7 @@ def cliques_vertex_clique_number(self, algorithm="cliquer", vertices=None, EXAMPLES:: sage: C = Graph('DJ{') - sage: C.cliques_vertex_clique_number() + sage: C.cliques_vertex_clique_number() # needs sage.plot {0: 2, 1: 4, 2: 4, 3: 4, 4: 4} sage: E = C.cliques_maximal(); E [[0, 4], [1, 2, 3, 4]] @@ -7510,12 +7512,12 @@ def cliques_vertex_clique_number(self, algorithm="cliquer", vertices=None, sage: F = graphs.Grid2dGraph(2,3) sage: F.cliques_vertex_clique_number(algorithm="networkx") # needs networkx {(0, 0): 2, (0, 1): 2, (0, 2): 2, (1, 0): 2, (1, 1): 2, (1, 2): 2} - sage: F.cliques_vertex_clique_number(vertices=[(0, 1), (1, 2)]) + sage: F.cliques_vertex_clique_number(vertices=[(0, 1), (1, 2)]) # needs sage.plot {(0, 1): 2, (1, 2): 2} sage: G = Graph({0:[1,2,3], 1:[2], 3:[0,1]}) sage: G.show(figsize=[2,2]) # needs sage.plot - sage: G.cliques_vertex_clique_number() + sage: G.cliques_vertex_clique_number() # needs sage.plot {0: 3, 1: 3, 2: 3, 3: 3} """ if algorithm == "cliquer": @@ -8283,9 +8285,9 @@ def is_inscribable(self, solver="ppl", verbose=0): EXAMPLES:: sage: H = graphs.HerschelGraph() - sage: H.is_inscribable() # long time (> 1 sec) + sage: H.is_inscribable() # long time (> 1 sec) # needs sage.numerical.mip False - sage: H.planar_dual().is_inscribable() # long time (> 1 sec) + sage: H.planar_dual().is_inscribable() # long time (> 1 sec) # needs sage.numerical.mip True sage: C = graphs.CubeGraph(3) @@ -8929,8 +8931,8 @@ def perfect_matchings(self, labels=False): [[(-2, 1, 'x'), (-1, 2, 'y')], [(-2, 2, 'b'), (-1, 1, 'a')]] sage: G = graphs.CompleteGraph(8) - sage: mpc = G.matching_polynomial().coefficients(sparse=False)[0] - sage: len(list(G.perfect_matchings())) == mpc + sage: mpc = G.matching_polynomial().coefficients(sparse=False)[0] # needs sage.libs.flint + sage: len(list(G.perfect_matchings())) == mpc # needs sage.libs.flint True sage: G = graphs.PetersenGraph().copy(immutable=True) @@ -9049,15 +9051,15 @@ def has_perfect_matching(self, algorithm="Edmonds", solver=None, verbose=0, True sage: graphs.WheelGraph(5).has_perfect_matching() # needs networkx False - sage: graphs.PetersenGraph().has_perfect_matching(algorithm="LP_matching") + sage: graphs.PetersenGraph().has_perfect_matching(algorithm="LP_matching") # needs sage.numerical.mip True - sage: graphs.WheelGraph(6).has_perfect_matching(algorithm="LP_matching") + sage: graphs.WheelGraph(6).has_perfect_matching(algorithm="LP_matching") # needs sage.numerical.mip True sage: graphs.WheelGraph(5).has_perfect_matching(algorithm="LP_matching") False - sage: graphs.PetersenGraph().has_perfect_matching(algorithm="LP_matching") + sage: graphs.PetersenGraph().has_perfect_matching(algorithm="LP_matching") # needs sage.numerical.mip True - sage: graphs.WheelGraph(6).has_perfect_matching(algorithm="LP_matching") + sage: graphs.WheelGraph(6).has_perfect_matching(algorithm="LP_matching") # needs sage.numerical.mip True sage: graphs.WheelGraph(5).has_perfect_matching(algorithm="LP_matching") False @@ -9156,7 +9158,7 @@ def effective_resistance(self, i, j, *, base_ring=None): Using a different base ring:: - sage: H.effective_resistance(1, 5, base_ring=RDF) # abs tol 1e-14 # needs sage.modules + sage: H.effective_resistance(1, 5, base_ring=RDF) # abs tol 1e-14 # needs numpy sage.modules 1.2000000000000000 sage: H.effective_resistance(1, 1, base_ring=RDF) # needs sage.modules 0.0 @@ -9189,7 +9191,7 @@ def effective_resistance(self, i, j, *, base_ring=None): 2/3 sage: G = Graph([(0,1),(0,2),(0,3),(0,4),(0,5),(1,2),(2,3),(3,4),(4,5),(5,1)]) sage: r = G.effective_resistance(0,3) - sage: r == fibonacci(2*(5-3)+1)*fibonacci(2*3-1)/fibonacci(2*5) + sage: r == fibonacci(2*(5-3)+1)*fibonacci(2*3-1)/fibonacci(2*5) # needs sage.libs.pari True sage: G = graphs.PathGraph(4) sage: G.delete_edge(2,3) @@ -9303,7 +9305,7 @@ def effective_resistance_matrix(self, vertices=None, nonedgesonly=True, A different base ring:: - sage: H.effective_resistance_matrix(base_ring=RDF)[0, 0].parent() # needs sage.modules + sage: H.effective_resistance_matrix(base_ring=RDF)[0, 0].parent() # needs numpy sage.modules Real Double Field .. SEEALSO:: diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 764ee160766..d93745b85b5 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -1598,7 +1598,7 @@ def _vizing_edge_coloring(g): True sage: all(g.has_edge(e) for C in colors for e in C) True - sage: all(len(Graph(C).matching()) == len(C) for C in colors) + sage: all(len(Graph(C).matching()) == len(C) for C in colors) # needs networkx True """ # This implementation was discussed in github issue #34809 @@ -2237,7 +2237,7 @@ cdef class Test: TESTS:: sage: from sage.graphs.graph_coloring import Test - sage: Test().random(1) + sage: Test().random(1) # needs sage.libs.flint """ self.random_all_graph_colorings(tests) @@ -2256,7 +2256,7 @@ cdef class Test: TESTS:: sage: from sage.graphs.graph_coloring import Test - sage: Test().random_all_graph_colorings(1) + sage: Test().random_all_graph_colorings(1) # needs sage.libs.flint """ from sage.graphs.generators.random import RandomGNP cdef set S diff --git a/src/sage/graphs/graph_database.py b/src/sage/graphs/graph_database.py index b8e9226bc2c..9dec951aa98 100644 --- a/src/sage/graphs/graph_database.py +++ b/src/sage/graphs/graph_database.py @@ -972,8 +972,8 @@ def query(self, query_dict=None, display_cols=None, **kwds): EXAMPLES:: sage: D = GraphDatabase() - sage: q = D.query(display_cols=['graph6', 'num_vertices', 'degree_sequence'], num_edges=['<=', 5]) - sage: q.show() + sage: q = D.query(display_cols=['graph6', 'num_vertices', 'degree_sequence'], num_edges=['<=', 5]) # needs sage.symbolic + sage: q.show() # needs sage.symbolic Graph6 Num Vertices Degree Sequence ------------------------------------------------------------ @ 1 [0] @@ -1109,7 +1109,7 @@ def interactive_query(self, display_cols, **kwds): EXAMPLES:: sage: D = GraphDatabase() - sage: D.interactive_query(display_cols=['graph6', 'num_vertices', 'degree_sequence'], num_edges=5, max_degree=3) + sage: D.interactive_query(display_cols=['graph6', 'num_vertices', 'degree_sequence'], num_edges=5, max_degree=3) # needs sage.symbolic Traceback (most recent call last): ... NotImplementedError: not available in Jupyter notebook diff --git a/src/sage/graphs/graph_decompositions/cutwidth.pyx b/src/sage/graphs/graph_decompositions/cutwidth.pyx index 208bd69dea4..ddaf746adac 100644 --- a/src/sage/graphs/graph_decompositions/cutwidth.pyx +++ b/src/sage/graphs/graph_decompositions/cutwidth.pyx @@ -335,7 +335,7 @@ def cutwidth(G, algorithm="exponential", cut_off=0, solver=None, verbose=False, Comparison of algorithms:: sage: from sage.graphs.graph_decompositions.cutwidth import cutwidth - sage: for i in range(2): # long time + sage: for i in range(2): # long time # needs sage.numerical.mip ....: G = graphs.RandomGNP(7, 0.3) ....: ve, le = cutwidth(G, algorithm="exponential") ....: vm, lm = cutwidth(G, algorithm="MILP", solver='GLPK') diff --git a/src/sage/graphs/graph_decompositions/graph_products.pyx b/src/sage/graphs/graph_decompositions/graph_products.pyx index 31f49206586..cd4f0b04c7d 100644 --- a/src/sage/graphs/graph_decompositions/graph_products.pyx +++ b/src/sage/graphs/graph_decompositions/graph_products.pyx @@ -397,12 +397,12 @@ def rooted_product(G, H, root=None): sage: G = graphs.RandomGNP(20, .3) sage: P = graphs.PathGraph(2) sage: R = G.rooted_product(P) - sage: len(R.dominating_set()) == G.order() + sage: len(R.dominating_set()) == G.order() # needs sage.numerical.mip True sage: G = digraphs.RandomDirectedGNP(20, .3) sage: P = digraphs.Path(2) sage: R = G.rooted_product(P) - sage: len(R.dominating_set()) == G.order() + sage: len(R.dominating_set()) == G.order() # needs sage.numerical.mip True The rooted product of two graphs is a subgraph of the cartesian product of diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index f1d53f31e95..e45371bc6d9 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -606,7 +606,7 @@ class GraphGenerators(): sage: L = list(graphs(5, lambda G: G.size() <= 4)) sage: len(L) 14 - sage: graphs_list.show_graphs(L) # long time + sage: graphs_list.show_graphs(L) # long time # needs sage.plot Generate all graphs with up to 5 vertices and up to 4 edges. @@ -615,7 +615,7 @@ class GraphGenerators(): sage: L = list(graphs(5, lambda G: G.size() <= 4, augment='vertices')) sage: len(L) 31 - sage: graphs_list.show_graphs(L) # long time + sage: graphs_list.show_graphs(L) # long time # needs sage.plot Generate all graphs with degree at most 2, up to 6 vertices. @@ -1280,7 +1280,7 @@ def cospectral_graphs(self, vertices, matrix_function=lambda g: g.adjacency_matr ....: for i in range(g.order()): ....: A.rescale_row(i, 1 / len(A.nonzero_positions_in_row(i))) ....: return A - sage: g = graphs.cospectral_graphs(5, matrix_function=DinverseA, # needs sage.modules + sage: g = graphs.cospectral_graphs(5, matrix_function=DinverseA, # needs sage.libs.pari sage.modules ....: graphs=lambda g: min(g.degree()) > 0) sage: sorted(sorted(g.graph6_string() for g in glist) for glist in g) # needs sage.modules [['Dlg', 'Ds_']] diff --git a/src/sage/graphs/graph_latex.py b/src/sage/graphs/graph_latex.py index e495ca160a4..76db076502c 100644 --- a/src/sage/graphs/graph_latex.py +++ b/src/sage/graphs/graph_latex.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.plot r""" LaTeX options for graphs diff --git a/src/sage/graphs/graph_plot_js.py b/src/sage/graphs/graph_plot_js.py index 3bcabb58152..f1045446d65 100644 --- a/src/sage/graphs/graph_plot_js.py +++ b/src/sage/graphs/graph_plot_js.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.plot r""" Graph plotting in Javascript with d3.js diff --git a/src/sage/graphs/hyperbolicity.pyx b/src/sage/graphs/hyperbolicity.pyx index d256c01e870..880fccfc8f9 100644 --- a/src/sage/graphs/hyperbolicity.pyx +++ b/src/sage/graphs/hyperbolicity.pyx @@ -1187,7 +1187,7 @@ def hyperbolicity(G, Comparison of results:: sage: from sage.graphs.hyperbolicity import hyperbolicity - sage: for i in range(10): # long time + sage: for i in range(10): # long time # needs networkx ....: G = graphs.RandomBarabasiAlbert(100,2) ....: d1,_,_ = hyperbolicity(G, algorithm='basic') ....: d2,_,_ = hyperbolicity(G, algorithm='CCL') @@ -1201,7 +1201,7 @@ def hyperbolicity(G, sage: from sage.graphs.hyperbolicity import hyperbolicity sage: import random sage: random.seed() - sage: for i in range(10): # long time + sage: for i in range(10): # long time # needs networkx ....: n = random.randint(2, 20) ....: m = random.randint(0, n*(n-1) / 2) ....: G = graphs.RandomGNM(n, m) diff --git a/src/sage/graphs/hypergraph_generators.py b/src/sage/graphs/hypergraph_generators.py index 3d6a7d28cd6..4291e024001 100644 --- a/src/sage/graphs/hypergraph_generators.py +++ b/src/sage/graphs/hypergraph_generators.py @@ -257,7 +257,7 @@ def UniformRandomUniform(self, n, k, m): Traceback (most recent call last): ... ValueError: the uniformity should be non-negative - sage: hypergraphs.UniformRandomUniform(52, I, 17) + sage: hypergraphs.UniformRandomUniform(52, I, 17) # needs sage.symbolic Traceback (most recent call last): ... ValueError: the uniformity should be an integer diff --git a/src/sage/graphs/independent_sets.pyx b/src/sage/graphs/independent_sets.pyx index 23c8677b34a..f1dc1260c34 100644 --- a/src/sage/graphs/independent_sets.pyx +++ b/src/sage/graphs/independent_sets.pyx @@ -141,12 +141,12 @@ cdef class IndependentSets: Compute the number of matchings, and check with Sage's implementation:: sage: from sage.graphs.independent_sets import IndependentSets - sage: from sage.graphs.matchpoly import matching_polynomial + sage: from sage.graphs.matchpoly import matching_polynomial # needs sage.libs.flint sage: def check_matching(G): ....: number_of_matchings = sum(map(abs, matching_polynomial(G).coefficients(sparse=False))) ....: if number_of_matchings != IndependentSets(G.line_graph()).cardinality(): ....: raise ValueError("something goes wrong") - sage: for i in range(30): + sage: for i in range(30): # needs sage.libs.flint ....: check_matching(graphs.RandomGNP(11, .3)) Compare the result with the output of :meth:`subgraph_search`:: diff --git a/src/sage/graphs/matchpoly.pyx b/src/sage/graphs/matchpoly.pyx index 22361379291..10c8d524164 100644 --- a/src/sage/graphs/matchpoly.pyx +++ b/src/sage/graphs/matchpoly.pyx @@ -1,4 +1,5 @@ # cython: binding=True +# sage.doctest: needs sage.libs.flint sage.graphs """ Matching polynomial diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index 25e803cc5d8..2c3cecfeed5 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -1922,8 +1922,8 @@ def SRG_100_44_18_20(): EXAMPLES:: sage: from sage.graphs.strongly_regular_db import SRG_100_44_18_20 - sage: G = SRG_100_44_18_20() # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = SRG_100_44_18_20() # long time # needs sage.groups + sage: G.is_strongly_regular(parameters=True) # long time # needs sage.groups (100, 44, 18, 20) """ L = ['100', '110', '130', '140', '200', '230', '240', '300', '310', '320', @@ -1944,8 +1944,8 @@ def SRG_100_45_20_20(): EXAMPLES:: sage: from sage.graphs.strongly_regular_db import SRG_100_45_20_20 - sage: G = SRG_100_45_20_20() # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = SRG_100_45_20_20() # long time # needs sage.groups + sage: G.is_strongly_regular(parameters=True) # long time # needs sage.groups (100, 45, 20, 20) """ L = ['120', '140', '200', '210', '201', '401', '411', '321', '002', '012', @@ -2435,8 +2435,8 @@ def SRG_560_208_72_80(): EXAMPLES:: sage: from sage.graphs.strongly_regular_db import SRG_560_208_72_80 - sage: g = SRG_560_208_72_80() # not tested (~2s) - sage: g.is_strongly_regular(parameters=True) # not tested (~2s) + sage: g = SRG_560_208_72_80() # not tested (~2s) # needs sage.libs.gap + sage: g.is_strongly_regular(parameters=True) # not tested (~2s) # needs sage.libs.gap (560, 208, 72, 80) """ from sage.libs.gap.libgap import libgap @@ -2616,8 +2616,8 @@ def SRG_630_85_20_10(): EXAMPLES:: sage: from sage.graphs.strongly_regular_db import SRG_630_85_20_10 - sage: G = SRG_630_85_20_10() # long time - sage: G.is_strongly_regular(parameters=True) # long time + sage: G = SRG_630_85_20_10() # long time # needs sage.groups + sage: G.is_strongly_regular(parameters=True) # long time # needs sage.groups (630, 85, 20, 10) """ from sage.graphs.generators.intersection import IntersectionGraph @@ -2812,7 +2812,7 @@ def strongly_regular_graph(int v, int k, int l, int mu=-1, bint existence=False, Petersen's graph from its set of parameters:: - sage: graphs.strongly_regular_graph(10,3,0,1,existence=True) + sage: graphs.strongly_regular_graph(10,3,0,1,existence=True) # needs sage.libs.pari True sage: graphs.strongly_regular_graph(10,3,0,1) complement(Johnson graph with parameters 5,2): Graph on 10 vertices @@ -3133,15 +3133,15 @@ def _build_small_srg_database(): complement(two-intersection set in PG(8,2)): Graph on 256 vertices sage: graphs.strongly_regular_graph(512, 73, 12, 10) # not tested (too long), needs sage.rings.finite_rings two-weight code: [219, 9] linear code over GF(2): Graph on 512 vertices - sage: graphs.strongly_regular_graph(512, 219, 106, 84) # long time + sage: graphs.strongly_regular_graph(512, 219, 106, 84) # long time, needs sage.combinat two-intersection set in PG(9,2): Graph on 512 vertices sage: graphs.strongly_regular_graph(512, 315, 202, 180) # not tested (too long), needs sage.rings.finite_rings two-weight code: [70, 9] linear code over GF(2): Graph on 512 vertices - sage: graphs.strongly_regular_graph(625, 364, 213, 210) # long time + sage: graphs.strongly_regular_graph(625, 364, 213, 210) # long time, needs sage.libs.pari complement(two-intersection set in PG(4,5)): Graph on 625 vertices - sage: graphs.strongly_regular_graph(625, 416, 279, 272) # long time + sage: graphs.strongly_regular_graph(625, 416, 279, 272) # long time, needs sage.libs.pari complement(two-intersection set in PG(4,5)): Graph on 625 vertices - sage: graphs.strongly_regular_graph(625, 468, 353, 342) # long time + sage: graphs.strongly_regular_graph(625, 468, 353, 342) # long time, needs sage.libs.pari complement(two-intersection set in PG(4,5)): Graph on 625 vertices sage: graphs.strongly_regular_graph(729, 336, 153,156) # not tested (too long) two-intersection set in PG(6,3): Graph on 729 vertices @@ -3286,7 +3286,7 @@ def _check_database(): EXAMPLES:: sage: from sage.graphs.strongly_regular_db import _check_database - sage: _check_database() # long time + sage: _check_database() # long time # needs sage.libs.pari Sage cannot build a (512 133 24 38 ) that exists. Comment ... ... In Andries Brouwer's database: diff --git a/src/sage/graphs/tutte_polynomial.py b/src/sage/graphs/tutte_polynomial.py index 5a7b048ddfe..e82150eeb9c 100644 --- a/src/sage/graphs/tutte_polynomial.py +++ b/src/sage/graphs/tutte_polynomial.py @@ -562,7 +562,7 @@ def tutte_polynomial(G, edge_selector=None, cache=None): sage: R = PolynomialRing(ZZ, 'x') sage: R((-1)^5*x*T(1-x,0)).factor() # needs sage.symbolic (x - 2) * (x - 1) * x * (x^3 - 9*x^2 + 29*x - 32) - sage: G.chromatic_polynomial().factor() + sage: G.chromatic_polynomial().factor() # needs sage.libs.flint (x - 2) * (x - 1) * x * (x^3 - 9*x^2 + 29*x - 32) TESTS: @@ -580,7 +580,7 @@ def tutte_polynomial(G, edge_selector=None, cache=None): sage: g.add_edges([(0,1,1),(1,5,2),(5,3,3),(5,2,4),(2,4,5),(0,2,6),(0,3,7),(0,4,8),(0,5,9)]) sage: g.tutte_polynomial()(1,1) 52 - sage: g.spanning_trees_count() + sage: g.spanning_trees_count() # needs sage.modules 52 """ R = ZZ['x, y'] diff --git a/src/sage/sandpiles/examples.py b/src/sage/sandpiles/examples.py index 6507992cc3c..bd6d409e770 100644 --- a/src/sage/sandpiles/examples.py +++ b/src/sage/sandpiles/examples.py @@ -156,10 +156,10 @@ def Fan(self, n, deg_three_verts=False): EXAMPLES:: sage: f = sandpiles.Fan(10) - sage: f.group_order() == fibonacci(18) + sage: f.group_order() == fibonacci(18) # needs sage.libs.pari True sage: f = sandpiles.Fan(10,True) # all nonsink vertices have deg 3 - sage: f.group_order() == fibonacci(20) + sage: f.group_order() == fibonacci(20) # needs sage.libs.pari True """ f = graphs.WheelGraph(n) diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index eca2303fc9f..b15323532b7 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -83,7 +83,7 @@ A picture of the graph:: - sage: S.show() # long time + sage: S.show() # long time # needs sage.plot The relevant Laplacian matrices:: @@ -205,17 +205,19 @@ the saturated homogeneous toppling ideal:: - sage: S.ideal() - Ideal (x1 - x0, x3*x2 - x0^2, x4^2 - x0^2, x2^3 - x4*x3*x0, x4*x2^2 - x3^2*x0, x3^3 - x4*x2*x0, x4*x3^2 - x2^2*x0) of Multivariate Polynomial Ring in x4, x3, x2, x1, x0 over Rational Field + sage: S.ideal() # needs sage.libs.singular + Ideal (x1 - x0, x3*x2 - x0^2, x4^2 - x0^2, x2^3 - x4*x3*x0, + x4*x2^2 - x3^2*x0, x3^3 - x4*x2*x0, x4*x3^2 - x2^2*x0) of + Multivariate Polynomial Ring in x4, x3, x2, x1, x0 over Rational Field its minimal free resolution:: - sage: S.resolution() + sage: S.resolution() # needs sage.libs.singular 'R^1 <-- R^7 <-- R^15 <-- R^13 <-- R^4' and its Betti numbers:: - sage: S.betti() + sage: S.betti() # needs sage.libs.singular 0 1 2 3 4 ------------------------------------ 0: 1 1 - - - @@ -250,10 +252,13 @@ ....: m = m.add_random() ....: m, f = m.stabilize(True) ....: a.append(sum(f.values())) - sage: p = list_plot([[log(i+1),log(a.count(i))] for i in [0..max(a)] if a.count(i)]) - sage: p.axes_labels(['log(N)','log(D(N))']) + + sage: # needs sage.plot + sage: p = list_plot([[log(i + 1), log(a.count(i))] + ....: for i in [0..max(a)] if a.count(i)]) + sage: p.axes_labels(['log(N)', 'log(D(N))']) sage: t = text("Distribution of avalanche sizes", (2,2), rgbcolor=(1,0,0)) - sage: show(p+t,axes_labels=['log(N)','log(D(N))']) # long time + sage: show(p + t, axes_labels=['log(N)', 'log(D(N))']) # long time Working with sandpile divisors:: @@ -275,6 +280,8 @@ {0: 4, 1: 0, 2: 0, 3: 1} sage: D.rank() 2 + + sage: # needs sage.geometry.polyhedron sage: sorted(D.effective_div(), key=str) [{0: 0, 1: 0, 2: 0, 3: 5}, {0: 0, 1: 0, 2: 4, 3: 1}, @@ -296,6 +303,7 @@ -1 sage: (D - E).effective_div() [] + sage: D.weierstrass_pts() (0, 1, 2, 3) sage: D.weierstrass_rank_seq(0) @@ -792,8 +800,8 @@ def show(self, **kwds): EXAMPLES:: sage: S = Sandpile({0:[], 1:[0,3,4], 2:[0,3,5], 3:[2,5], 4:[1,1], 5:[2,4]}) - sage: S.show() - sage: S.show(graph_border=True, edge_labels=True) + sage: S.show() # needs sage.plot + sage: S.show(graph_border=True, edge_labels=True) # needs sage.plot """ if self.is_undirected(): @@ -812,7 +820,7 @@ def show3d(self, **kwds): EXAMPLES:: sage: S = sandpiles.House() - sage: S.show3d() # long time + sage: S.show3d() # long time # needs sage.plot """ if self.is_undirected(): @@ -1375,7 +1383,7 @@ def recurrents(self, verbose=True): sage: r = Sandpile(graphs.HouseXGraph(),0).recurrents() sage: r[:3] [{1: 2, 2: 3, 3: 3, 4: 1}, {1: 1, 2: 3, 3: 3, 4: 0}, {1: 1, 2: 3, 3: 3, 4: 1}] - sage: sandpiles.Complete(4).recurrents(False) + sage: sandpiles.Complete(4).recurrents(False) # needs sage.combinat [[2, 2, 2], [2, 2, 1], [2, 1, 2], @@ -1434,7 +1442,7 @@ def superstables(self, verbose=True): sage: sp = Sandpile(graphs.HouseXGraph(),0).superstables() sage: sp[:3] [{1: 0, 2: 0, 3: 0, 4: 0}, {1: 1, 2: 0, 3: 0, 4: 1}, {1: 1, 2: 0, 3: 0, 4: 0}] - sage: sandpiles.Complete(4).superstables(False) + sage: sandpiles.Complete(4).superstables(False) # needs sage.combinat [[0, 0, 0], [0, 0, 1], [0, 1, 0], @@ -1555,8 +1563,8 @@ def _set_min_recurrents(self): EXAMPLES:: sage: s = sandpiles.Complete(4) - sage: s._set_min_recurrents() - sage: '_min_recurrents' in s.__dict__ + sage: s._set_min_recurrents() # needs sage.combinat + sage: '_min_recurrents' in s.__dict__ # needs sage.combinat True """ if self.is_undirected(): @@ -1660,7 +1668,7 @@ def tutte_polynomial(self): x^3 + y^3 + 3*x^2 + 4*x*y + 3*y^2 + 2*x + 2*y sage: s.tutte_polynomial().subs(x=1) y^3 + 3*y^2 + 6*y + 6 - sage: s.tutte_polynomial().subs(x=1).coefficients() == s.h_vector() + sage: s.tutte_polynomial().subs(x=1).coefficients() == s.h_vector() # needs sage.combinat True """ if self.is_undirected(): @@ -1675,8 +1683,8 @@ def _set_avalanche_polynomial(self): EXAMPLES:: sage: s = sandpiles.Complete(4) - sage: s._set_avalanche_polynomial() - sage: '_avalanche_polynomial' in s.__dict__ + sage: s._set_avalanche_polynomial() # needs sage.combinat + sage: '_avalanche_polynomial' in s.__dict__ # needs sage.combinat True """ n = self.num_verts() - 1 @@ -1708,9 +1716,9 @@ def avalanche_polynomial(self, multivariable=True): EXAMPLES:: sage: s = sandpiles.Complete(4) - sage: s.avalanche_polynomial() + sage: s.avalanche_polynomial() # needs sage.combinat 9*x0*x1*x2 + 2*x0*x1 + 2*x0*x2 + 2*x1*x2 + 3*x0 + 3*x1 + 3*x2 + 24 - sage: s.avalanche_polynomial(False) + sage: s.avalanche_polynomial(False) # needs sage.combinat 9*x0^3 + 6*x0^2 + 9*x0 + 24 .. NOTE:: @@ -1747,12 +1755,13 @@ def nonspecial_divisors(self, verbose=True): EXAMPLES:: + sage: # needs sage.combinat sage: S = sandpiles.Complete(4) sage: ns = S.nonspecial_divisors() sage: D = ns[0] - sage: D.values() + sage: D.values() # needs sage.symbolic [-1, 0, 1, 2] - sage: D.deg() + sage: D.deg() # needs sage.symbolic 2 sage: [i.effective_div() for i in ns] [[], [], [], [], [], []] @@ -1914,7 +1923,7 @@ def postulation(self): EXAMPLES:: sage: s = sandpiles.Complete(4) - sage: s.postulation() + sage: s.postulation() # needs sage.combinat 3 """ return self._postulation @@ -2000,8 +2009,8 @@ def _set_jacobian_representatives(self): EXAMPLES:: sage: s = sandpiles.Complete(3) - sage: s._set_jacobian_representatives() - sage: '_jacobian_representatives' in s.__dict__ + sage: s._set_jacobian_representatives() # needs sage.combinat + sage: '_jacobian_representatives' in s.__dict__ # needs sage.combinat True """ if self.is_undirected(): @@ -2055,9 +2064,9 @@ def jacobian_representatives(self, verbose=True): representatives for the Jacobian group.:: sage: s = sandpiles.Complete(3) - sage: s.superstables(False) + sage: s.superstables(False) # needs sage.combinat [[0, 0], [0, 1], [1, 0]] - sage: s.jacobian_representatives(False) + sage: s.jacobian_representatives(False) # needs sage.combinat [[0, 0, 0], [-1, 0, 1], [-1, 1, 0]] If the graph is directed, the representatives described above may by @@ -2066,7 +2075,7 @@ def jacobian_representatives(self, verbose=True): sage: s = Sandpile({0: {1: 1, 2: 2}, 1: {0: 2, 2: 4}, 2: {0: 4, 1: 2}},0) sage: s.group_order() 28 - sage: s.jacobian_representatives() + sage: s.jacobian_representatives() # needs sage.symbolic [{0: -5, 1: 3, 2: 2}, {0: -4, 1: 3, 2: 1}] Let `\tau` be the nonnegative generator of the kernel of the transpose of @@ -2107,11 +2116,11 @@ def picard_representatives(self, d, verbose=True): EXAMPLES:: sage: s = sandpiles.Complete(3) - sage: s.superstables(False) + sage: s.superstables(False) # needs sage.combinat [[0, 0], [0, 1], [1, 0]] - sage: s.jacobian_representatives(False) + sage: s.jacobian_representatives(False) # needs sage.combinat [[0, 0, 0], [-1, 0, 1], [-1, 1, 0]] - sage: s.picard_representatives(3,False) + sage: s.picard_representatives(3,False) # needs sage.combinat [[3, 0, 0], [2, 0, 1], [2, 1, 0]] """ D = self.zero_div() @@ -2142,12 +2151,12 @@ def stable_configs(self, smax=None): sage: s = sandpiles.Complete(3) sage: a = s.stable_configs() - sage: next(a) + sage: next(a) # needs sage.combinat {1: 0, 2: 0} - sage: [i.values() for i in a] + sage: [i.values() for i in a] # needs sage.combinat [[0, 1], [1, 0], [1, 1]] sage: b = s.stable_configs([1,0]) - sage: list(b) + sage: list(b) # needs sage.combinat [{1: 0, 2: 0}, {1: 1, 2: 0}] """ if smax is None: @@ -2317,6 +2326,8 @@ def stationary_density(self): sage: s = sandpiles.Complete(3) sage: s.stationary_density() 10/9 + + sage: # needs sage.combinat sage: s = Sandpile(digraphs.DeBruijn(2,2),'00') sage: s.stationary_density() 9/8 @@ -2378,8 +2389,8 @@ def _set_betti_complexes(self): EXAMPLES:: sage: S = Sandpile({0:{},1:{0: 1, 2: 1, 3: 4},2:{3: 5},3:{1: 1, 2: 1}},0) - sage: S._set_betti_complexes() - sage: '_betti_complexes' in S.__dict__ + sage: S._set_betti_complexes() # needs sage.geometry.polyhedron + sage: '_betti_complexes' in S.__dict__ # needs sage.geometry.polyhedron True """ results = [] @@ -2412,13 +2423,15 @@ def betti_complexes(self): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: S = Sandpile({0:{},1:{0: 1, 2: 1, 3: 4},2:{3: 5},3:{1: 1, 2: 1}},0) sage: p = S.betti_complexes() sage: p[0] - [{0: -8, 1: 5, 2: 4, 3: 1}, Simplicial complex with vertex set (1, 2, 3) and facets {(3,), (1, 2)}] - sage: S.resolution() + [{0: -8, 1: 5, 2: 4, 3: 1}, + Simplicial complex with vertex set (1, 2, 3) and facets {(3,), (1, 2)}] + sage: S.resolution() # needs sage.libs.singular 'R^1 <-- R^5 <-- R^5 <-- R^1' - sage: S.betti() + sage: S.betti() # needs sage.libs.singular 0 1 2 3 ------------------------------ 0: 1 - - - @@ -2489,8 +2502,8 @@ def _set_ideal(self): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S._set_ideal() - sage: '_ideal' in S.__dict__ + sage: S._set_ideal() # needs sage.libs.singular + sage: '_ideal' in S.__dict__ # needs sage.libs.singular True """ from sage.libs.singular.function_factory import ff @@ -2516,8 +2529,9 @@ def unsaturated_ideal(self): sage: S = sandpiles.Diamond() sage: S.unsaturated_ideal().gens() [x1^3 - x3*x2*x0, x2^3 - x3*x1*x0, x3^2 - x2*x1] - sage: S.ideal().gens() - [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] + sage: S.ideal().gens() # needs sage.libs.singular + [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, + x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] """ return self._unsaturated_ideal @@ -2537,12 +2551,16 @@ def ideal(self, gens=False): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S.ideal() - Ideal (x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0) of Multivariate Polynomial Ring in x3, x2, x1, x0 over Rational Field - sage: S.ideal(True) - [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] - sage: S.ideal().gens() # another way to get the generators - [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] + sage: S.ideal() # needs sage.libs.singular + Ideal (x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, + x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0) + of Multivariate Polynomial Ring in x3, x2, x1, x0 over Rational Field + sage: S.ideal(True) # needs sage.libs.singular + [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, + x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] + sage: S.ideal().gens() # another way to get the generators # needs sage.libs.singular + [x2*x1 - x0^2, x3^2 - x0^2, x1^3 - x3*x2*x0, + x3*x1^2 - x2^2*x0, x2^3 - x3*x1*x0, x3*x2^2 - x1^2*x0] """ if gens: return self._ideal.gens() @@ -2581,8 +2599,8 @@ def _set_resolution(self): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S._set_resolution() - sage: '_resolution' in S.__dict__ + sage: S._set_resolution() # needs sage.libs.singular + sage: '_resolution' in S.__dict__ # needs sage.libs.singular True """ # get the resolution in singular form @@ -2624,6 +2642,7 @@ def resolution(self, verbose=False): EXAMPLES:: + sage: # needs sage.libs.singular sage: S = Sandpile({0: {}, 1: {0: 1, 2: 1, 3: 4}, 2: {3: 5}, 3: {1: 1, 2: 1}},0) sage: S.resolution() # a Gorenstein sandpile graph 'R^1 <-- R^5 <-- R^5 <-- R^1' @@ -2661,8 +2680,8 @@ def _set_groebner(self): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S._set_groebner() - sage: '_groebner' in S.__dict__ + sage: S._set_groebner() # needs sage.libs.singular + sage: '_groebner' in S.__dict__ # needs sage.libs.singular True """ self._groebner = self._ideal.groebner_basis() @@ -2679,8 +2698,9 @@ def groebner(self): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S.groebner() - [x3*x2^2 - x1^2*x0, x2^3 - x3*x1*x0, x3*x1^2 - x2^2*x0, x1^3 - x3*x2*x0, x3^2 - x0^2, x2*x1 - x0^2] + sage: S.groebner() # needs sage.libs.singular + [x3*x2^2 - x1^2*x0, x2^3 - x3*x1*x0, x3*x1^2 - x2^2*x0, + x1^3 - x3*x2*x0, x3^2 - x0^2, x2*x1 - x0^2] """ return self._groebner @@ -2702,7 +2722,7 @@ def betti(self, verbose=True): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S.betti() + sage: S.betti() # needs sage.libs.singular 0 1 2 3 ------------------------------ 0: 1 - - - @@ -2710,7 +2730,7 @@ def betti(self, verbose=True): 2: - 4 9 4 ------------------------------ total: 1 6 9 4 - sage: S.betti(False) + sage: S.betti(False) # needs sage.libs.singular [1, 6, 9, 4] """ if verbose: @@ -2731,7 +2751,7 @@ def solve(self): EXAMPLES:: sage: S = Sandpile({0: {}, 1: {2: 2}, 2: {0: 4, 1: 1}}, 0) - sage: S.solve() + sage: Z = S.solve(); Z # needs sage.libs.singular [[-0.707107000000000 + 0.707107000000000*I, 0.707107000000000 - 0.707107000000000*I], [-0.707107000000000 - 0.707107000000000*I, @@ -2744,7 +2764,7 @@ def solve(self): -0.707107000000000 + 0.707107000000000*I], [1, 1], [-1, -1]] - sage: len(_) + sage: len(Z) # needs sage.libs.singular 8 sage: S.group_order() 8 @@ -2779,8 +2799,8 @@ def _set_points(self): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: S._set_points() - sage: '_points' in S.__dict__ + sage: S._set_points() # needs sage.symbolic + sage: '_points' in S.__dict__ # needs sage.symbolic True """ L = self._reduced_laplacian.transpose().dense_matrix() @@ -2811,7 +2831,7 @@ def points(self): :: sage: S = sandpiles.Complete(4) - sage: S.points() + sage: S.points() # needs sage.symbolic [[-I, I, 1], [-I, 1, I]] """ return self._points @@ -3763,10 +3783,13 @@ def add_random(self, distrib=None): ....: m = m.add_random() ....: m, f = m.stabilize(True) ....: a.append(sum(f.values())) - sage: p = list_plot([[log(i+1),log(a.count(i))] for i in [0..max(a)] if a.count(i)]) - sage: p.axes_labels(['log(N)','log(D(N))']) + + sage: # needs sage.plot + sage: p = list_plot([[log(i + 1), log(a.count(i))] + ....: for i in [0..max(a)] if a.count(i)]) + sage: p.axes_labels(['log(N)', 'log(D(N))']) sage: t = text("Distribution of avalanche sizes", (2,2), rgbcolor=(1,0,0)) - sage: show(p+t,axes_labels=['log(N)','log(D(N))']) # long time + sage: show(p + t, axes_labels=['log(N)', 'log(D(N))']) # long time .. NOTE:: @@ -4145,9 +4168,9 @@ def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): sage: S = sandpiles.Diamond() sage: c = S.identity() - sage: c.show() - sage: c.show(directed=False) - sage: c.show(sink=False,colors=False,heights=True) + sage: c.show() # needs sage.plot + sage: c.show(directed=False) # needs sage.plot + sage: c.show(sink=False, colors=False, heights=True) # needs sage.plot """ if directed: T = DiGraph(self.sandpile()) @@ -4325,8 +4348,8 @@ def __setitem__(self, key, item): sage: S = sandpiles.Cycle(3) sage: D = SandpileDivisor(S,[0,1,1]) - sage: eff = D.effective_div() - sage: D.__dict__ + sage: eff = D.effective_div() # needs sage.geometry.polyhedron + sage: D.__dict__ # needs sage.geometry.polyhedron {'_effective_div': [{0: 0, 1: 1, 2: 1}, {0: 2, 1: 0, 2: 0}], '_polytope': A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 3 vertices, '_polytope_integer_pts': ((0, 0), (1, 1)), @@ -5197,8 +5220,8 @@ def _set_polytope(self): sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) - sage: D._set_polytope() - sage: '_polytope' in D.__dict__ + sage: D._set_polytope() # needs sage.geometry.polyhedron + sage: '_polytope' in D.__dict__ # needs sage.geometry.polyhedron True """ S = self.sandpile() @@ -5216,6 +5239,7 @@ def polytope(self): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) sage: p = D.polytope() @@ -5248,8 +5272,8 @@ def _set_polytope_integer_pts(self): sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) - sage: D._set_polytope_integer_pts() - sage: '_polytope_integer_pts' in D.__dict__ + sage: D._set_polytope_integer_pts() # needs sage.geometry.polyhedron + sage: '_polytope_integer_pts' in D.__dict__ # needs sage.geometry.polyhedron True """ self._polytope_integer_pts = self._polytope.integral_points() @@ -5268,7 +5292,7 @@ def polytope_integer_pts(self): sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) - sage: sorted(D.polytope_integer_pts()) + sage: sorted(D.polytope_integer_pts()) # needs sage.geometry.polyhedron [(-2, -1, -1), (-1, -2, -1), (-1, -1, -2), @@ -5276,7 +5300,7 @@ def polytope_integer_pts(self): (0, -1, -1), (0, 0, 0)] sage: D = SandpileDivisor(s,[-1,0,0,0]) - sage: D.polytope_integer_pts() + sage: D.polytope_integer_pts() # needs sage.geometry.polyhedron () """ return deepcopy(self._polytope_integer_pts) @@ -5289,8 +5313,8 @@ def _set_effective_div(self): sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) - sage: D._set_effective_div() - sage: '_effective_div' in D.__dict__ + sage: D._set_effective_div() # needs sage.geometry.polyhedron + sage: '_effective_div' in D.__dict__ # needs sage.geometry.polyhedron True """ S = self.sandpile() @@ -5319,6 +5343,7 @@ def effective_div(self, verbose=True, with_firing_vectors=False): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: s = sandpiles.Complete(4) sage: D = SandpileDivisor(s,[4,2,0,0]) sage: sorted(D.effective_div(), key=str) @@ -5392,8 +5417,8 @@ def _set_rank(self, set_witness=False): True sage: '_rank_witness' in D.__dict__ False - sage: D._set_rank(True) - sage: '_rank_witness' in D.__dict__ + sage: D._set_rank(True) # needs sage.geometry.polyhedron + sage: '_rank_witness' in D.__dict__ # needs sage.geometry.polyhedron True sage: D = SandpileDivisor(s,[1,0,0,0]) sage: D._set_rank() @@ -5460,6 +5485,7 @@ def rank(self, with_witness=False): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: S = sandpiles.Complete(4) sage: D = SandpileDivisor(S,[4,2,0,0]) sage: D.rank() @@ -5467,19 +5493,21 @@ def rank(self, with_witness=False): sage: D.rank(True) (3, {0: 3, 1: 0, 2: 1, 3: 0}) sage: E = _[1] - sage: (D - E).rank() + sage: (D - E).rank() # needs sage.rings.number_field -1 Riemann-Roch theorem:: + sage: # needs sage.geometry.polyhedron sage: D.rank() - (S.canonical_divisor()-D).rank() == D.deg() + 1 - S.genus() True Riemann-Roch theorem:: + sage: # needs sage.geometry.polyhedron sage: D.rank() - (S.canonical_divisor()-D).rank() == D.deg() + 1 - S.genus() True - sage: S = Sandpile({0:[1,1,1,2],1:[0,0,0,1,1,1,2,2],2:[2,2,1,1,0]},0) # multigraph with loops + sage: S = Sandpile({0:[1,1,1,2],1:[0,0,0,1,1,1,2,2],2:[2,2,1,1,0]},0) # multigraph with loops sage: D = SandpileDivisor(S,[4,2,0]) sage: D.rank(True) (2, {0: 1, 1: 1, 2: 1}) @@ -5492,7 +5520,7 @@ def rank(self, with_witness=False): sage: D.rank(True) (0, {0: 0, 1: 0, 2: 1}) sage: E = D.rank(True)[1] - sage: (D - E).effective_div() + sage: (D - E).effective_div() # needs sage.rings.number_field [] .. NOTE:: @@ -5519,8 +5547,8 @@ def _set_r_of_D(self, verbose=False): EXAMPLES:: sage: S = sandpiles.Cycle(6) - sage: D = SandpileDivisor(S, [0,0,0,0,0,4]) # optional - 4ti2 - sage: D._set_r_of_D() # optional - 4ti2 + sage: D = SandpileDivisor(S, [0,0,0,0,0,4]) # optional - 4ti2 + sage: D._set_r_of_D() # optional - 4ti2 """ eff = self.effective_div() n = self._sandpile.num_verts() @@ -5573,7 +5601,7 @@ def weierstrass_rank_seq(self, v='sink'): sage: s = sandpiles.House() sage: K = s.canonical_divisor() - sage: [K.weierstrass_rank_seq(v) for v in s.vertices(sort=True)] + sage: [K.weierstrass_rank_seq(v) for v in s.vertices(sort=True)] # needs sage.geometry.polyhedron [(1, 0, -1), (1, 0, -1), (1, 0, -1), (1, 0, -1), (1, 0, 0, -1)] """ s = self.sandpile() @@ -5613,13 +5641,14 @@ def weierstrass_gap_seq(self, v='sink', weight=True): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: s = sandpiles.Cycle(4) sage: D = SandpileDivisor(s,[2,0,0,0]) sage: [D.weierstrass_gap_seq(v,False) for v in s.vertices(sort=True)] [(1, 3), (1, 2), (1, 3), (1, 2)] sage: [D.weierstrass_gap_seq(v) for v in s.vertices(sort=True)] [((1, 3), 1), ((1, 2), 0), ((1, 3), 1), ((1, 2), 0)] - sage: D.weierstrass_gap_seq() # gap sequence at sink vertex, 0 + sage: D.weierstrass_gap_seq() # gap sequence at sink vertex, 0 ((1, 3), 1) sage: D.weierstrass_rank_seq() # rank sequence at the sink vertex (1, 0, 0, -1) @@ -5655,6 +5684,7 @@ def is_weierstrass_pt(self, v='sink'): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: s = sandpiles.House() sage: K = s.canonical_divisor() sage: K.weierstrass_rank_seq() # sequence at the sink vertex, 0 @@ -5682,8 +5712,8 @@ def _set_weierstrass_pts(self): sage: s = sandpiles.Diamond() sage: D = SandpileDivisor(s, [2,1,0,0]) - sage: D._set_weierstrass_pts() - sage: '_weierstrass_pts' in D.__dict__ + sage: D._set_weierstrass_pts() # needs sage.geometry.polyhedron + sage: '_weierstrass_pts' in D.__dict__ # needs sage.geometry.polyhedron True """ self._weierstrass_pts = tuple([v for v in self.sandpile().vertices(sort=True) @@ -5705,9 +5735,9 @@ def weierstrass_pts(self, with_rank_seq=False): sage: s = sandpiles.House() sage: K = s.canonical_divisor() - sage: K.weierstrass_pts() + sage: K.weierstrass_pts() # needs sage.geometry.polyhedron (4,) - sage: K.weierstrass_pts(True) + sage: K.weierstrass_pts(True) # needs sage.geometry.polyhedron [(4, (1, 0, 0, -1))] .. NOTE:: @@ -5739,12 +5769,12 @@ def weierstrass_div(self, verbose=True): sage: s = sandpiles.Diamond() sage: D = SandpileDivisor(s,[4,2,1,0]) - sage: [D.weierstrass_rank_seq(v) for v in s] + sage: [D.weierstrass_rank_seq(v) for v in s] # needs sage.geometry.polyhedron [(5, 4, 3, 2, 1, 0, 0, -1), (5, 4, 3, 2, 1, 0, -1), (5, 4, 3, 2, 1, 0, 0, 0, -1), (5, 4, 3, 2, 1, 0, 0, -1)] - sage: D.weierstrass_div() + sage: D.weierstrass_div() # needs sage.geometry.polyhedron {0: 1, 1: 0, 2: 2, 3: 1} sage: k5 = sandpiles.Complete(5) sage: K = k5.canonical_divisor() @@ -5787,8 +5817,8 @@ def _set_Dcomplex(self): sage: S = sandpiles.Complete(4) sage: D = SandpileDivisor(S, [0,0,1,1]) - sage: D._set_Dcomplex() - sage: '_Dcomplex' in D.__dict__ + sage: D._set_Dcomplex() # needs sage.geometry.polyhedron + sage: '_Dcomplex' in D.__dict__ # needs sage.geometry.polyhedron True """ simp = [] @@ -5824,6 +5854,7 @@ def Dcomplex(self): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: S = sandpiles.House() sage: p = SandpileDivisor(S, [1,2,1,0,0]).Dcomplex() sage: p.homology() @@ -5852,7 +5883,7 @@ def betti(self): sage: S = sandpiles.Cycle(3) sage: D = SandpileDivisor(S, [2,0,1]) - sage: D.betti() + sage: D.betti() # needs sage.geometry.polyhedron {0: 1, 1: 1} .. NOTE:: @@ -6045,8 +6076,8 @@ def show(self, heights=True, directed=None, **kwds): EXAMPLES:: sage: S = sandpiles.Diamond() - sage: D = SandpileDivisor(S,[1,-2,0,2]) - sage: D.show(graph_border=True,vertex_size=700,directed=False) + sage: D = SandpileDivisor(S, [1,-2,0,2]) + sage: D.show(graph_border=True, vertex_size=700, directed=False) # needs sage.plot """ if directed: T = DiGraph(self.sandpile()) @@ -6097,7 +6128,7 @@ def sandlib(selector=None): riemann-roch1 : directed graph with postulation 9 and 3 maximal weight superstables riemann-roch2 : directed graph with a superstable not majorized by a maximal superstable sage: S = sandlib('gor') - sage: S.resolution() + sage: S.resolution() # needs sage.libs.singular 'R^1 <-- R^5 <-- R^5 <-- R^1' """ # The convention is for the sink to be zero. @@ -6289,7 +6320,7 @@ def glue_graphs(g, h, glue_g, glue_h): sage: S = Sandpile(z,'sink') sage: S.h_vector() [1, 6, 17, 31, 41, 41, 31, 17, 6, 1] - sage: S.resolution() + sage: S.resolution() # needs sage.libs.singular 'R^1 <-- R^7 <-- R^21 <-- R^35 <-- R^35 <-- R^21 <-- R^7 <-- R^1' .. NOTE:: @@ -6361,8 +6392,9 @@ def firing_graph(S, eff): sage: S = sandpiles.Cycle(6) sage: D = SandpileDivisor(S, [1,1,1,1,2,0]) - sage: eff = D.effective_div() - sage: firing_graph(S,eff).show3d(edge_size=.005,vertex_size=0.01) # long time + sage: eff = D.effective_div() # needs sage.geometry.polyhedron + sage: firing_graph(S, eff).show3d(edge_size=.005, # long time, needs sage.geometry.polyhedron sage.plot + ....: vertex_size=0.01) """ g = DiGraph() g.add_vertices(range(len(eff))) @@ -6397,8 +6429,9 @@ def parallel_firing_graph(S, eff): sage: S = sandpiles.Cycle(6) sage: D = SandpileDivisor(S, [1,1,1,1,2,0]) - sage: eff = D.effective_div() - sage: parallel_firing_graph(S,eff).show3d(edge_size=.005,vertex_size=0.01) # long time + sage: eff = D.effective_div() # needs sage.geometry.polyhedron + sage: parallel_firing_graph(S, eff).show3d(edge_size=.005, # long time, needs sage.geometry.polyhedron sage.plot + ....: vertex_size=0.01) """ g = DiGraph() g.add_vertices(range(len(eff))) @@ -6436,8 +6469,8 @@ def admissible_partitions(S, k): sage: from sage.sandpiles.sandpile import admissible_partitions sage: from sage.sandpiles.sandpile import partition_sandpile sage: S = sandpiles.Cycle(4) - sage: P = [admissible_partitions(S, i) for i in [2,3,4]] - sage: P + sage: P = [admissible_partitions(S, i) for i in [2,3,4]] # needs sage.combinat + sage: P # needs sage.combinat [[{{0, 2, 3}, {1}}, {{0, 3}, {1, 2}}, {{0, 1, 3}, {2}}, @@ -6449,12 +6482,12 @@ def admissible_partitions(S, k): {{0}, {1, 2}, {3}}, {{0, 1}, {2}, {3}}], [{{0}, {1}, {2}, {3}}]] - sage: for p in P: + sage: for p in P: # needs sage.combinat ....: sum([partition_sandpile(S, i).betti(verbose=False)[-1] for i in p]) 6 8 3 - sage: S.betti() + sage: S.betti() # needs sage.libs.singular 0 1 2 3 ------------------------------ 0: 1 - - - @@ -6494,13 +6527,13 @@ def partition_sandpile(S, p): sage: from sage.sandpiles.sandpile import admissible_partitions, partition_sandpile sage: S = sandpiles.Cycle(4) - sage: P = [admissible_partitions(S, i) for i in [2,3,4]] - sage: for p in P: + sage: P = [admissible_partitions(S, i) for i in [2,3,4]] # needs sage.combinat + sage: for p in P: # needs sage.combinat ....: sum([partition_sandpile(S, i).betti(verbose=False)[-1] for i in p]) 6 8 3 - sage: S.betti() + sage: S.betti() # needs sage.libs.singular 0 1 2 3 ------------------------------ 0: 1 - - -