passagemath-graphs 10.5.43__cp39-cp39-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. passagemath_graphs-10.5.43.dist-info/METADATA +293 -0
  2. passagemath_graphs-10.5.43.dist-info/RECORD +258 -0
  3. passagemath_graphs-10.5.43.dist-info/WHEEL +5 -0
  4. passagemath_graphs-10.5.43.dist-info/top_level.txt +2 -0
  5. passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
  6. passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
  7. passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
  8. sage/all__sagemath_graphs.py +39 -0
  9. sage/combinat/abstract_tree.py +2552 -0
  10. sage/combinat/all__sagemath_graphs.py +34 -0
  11. sage/combinat/binary_tree.py +5306 -0
  12. sage/combinat/cluster_algebra_quiver/all.py +22 -0
  13. sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
  14. sage/combinat/cluster_algebra_quiver/interact.py +125 -0
  15. sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
  16. sage/combinat/cluster_algebra_quiver/mutation_type.py +1556 -0
  17. sage/combinat/cluster_algebra_quiver/quiver.py +2262 -0
  18. sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
  19. sage/combinat/designs/MOLS_handbook_data.py +570 -0
  20. sage/combinat/designs/all.py +58 -0
  21. sage/combinat/designs/bibd.py +1655 -0
  22. sage/combinat/designs/block_design.py +1071 -0
  23. sage/combinat/designs/covering_array.py +269 -0
  24. sage/combinat/designs/covering_design.py +534 -0
  25. sage/combinat/designs/database.py +5614 -0
  26. sage/combinat/designs/design_catalog.py +122 -0
  27. sage/combinat/designs/designs_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  28. sage/combinat/designs/designs_pyx.pxd +21 -0
  29. sage/combinat/designs/designs_pyx.pyx +993 -0
  30. sage/combinat/designs/difference_family.py +3951 -0
  31. sage/combinat/designs/difference_matrices.py +279 -0
  32. sage/combinat/designs/evenly_distributed_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  33. sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
  34. sage/combinat/designs/ext_rep.py +1064 -0
  35. sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-aarch64-linux-gnu.so +0 -0
  36. sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
  37. sage/combinat/designs/group_divisible_designs.py +361 -0
  38. sage/combinat/designs/incidence_structures.py +2357 -0
  39. sage/combinat/designs/latin_squares.py +548 -0
  40. sage/combinat/designs/orthogonal_arrays.py +2243 -0
  41. sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
  42. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-aarch64-linux-gnu.so +0 -0
  43. sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +966 -0
  44. sage/combinat/designs/resolvable_bibd.py +781 -0
  45. sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
  46. sage/combinat/designs/subhypergraph_search.cpython-39-aarch64-linux-gnu.so +0 -0
  47. sage/combinat/designs/subhypergraph_search.pyx +530 -0
  48. sage/combinat/designs/twographs.py +306 -0
  49. sage/combinat/finite_state_machine.py +14874 -0
  50. sage/combinat/finite_state_machine_generators.py +2006 -0
  51. sage/combinat/graph_path.py +448 -0
  52. sage/combinat/interval_posets.py +3908 -0
  53. sage/combinat/nu_tamari_lattice.py +269 -0
  54. sage/combinat/ordered_tree.py +1446 -0
  55. sage/combinat/posets/all.py +46 -0
  56. sage/combinat/posets/cartesian_product.py +493 -0
  57. sage/combinat/posets/d_complete.py +182 -0
  58. sage/combinat/posets/elements.py +273 -0
  59. sage/combinat/posets/forest.py +30 -0
  60. sage/combinat/posets/hasse_cython.cpython-39-aarch64-linux-gnu.so +0 -0
  61. sage/combinat/posets/hasse_cython.pyx +174 -0
  62. sage/combinat/posets/hasse_diagram.py +3678 -0
  63. sage/combinat/posets/incidence_algebras.py +796 -0
  64. sage/combinat/posets/lattices.py +5119 -0
  65. sage/combinat/posets/linear_extension_iterator.cpython-39-aarch64-linux-gnu.so +0 -0
  66. sage/combinat/posets/linear_extension_iterator.pyx +292 -0
  67. sage/combinat/posets/linear_extensions.py +1039 -0
  68. sage/combinat/posets/mobile.py +275 -0
  69. sage/combinat/posets/moebius_algebra.py +776 -0
  70. sage/combinat/posets/poset_examples.py +2131 -0
  71. sage/combinat/posets/posets.py +9169 -0
  72. sage/combinat/rooted_tree.py +1070 -0
  73. sage/combinat/shard_order.py +239 -0
  74. sage/combinat/tamari_lattices.py +384 -0
  75. sage/combinat/yang_baxter_graph.py +923 -0
  76. sage/databases/all__sagemath_graphs.py +1 -0
  77. sage/databases/knotinfo_db.py +1230 -0
  78. sage/ext_data/all__sagemath_graphs.py +1 -0
  79. sage/ext_data/graphs/graph_plot_js.html +330 -0
  80. sage/ext_data/kenzo/CP2.txt +45 -0
  81. sage/ext_data/kenzo/CP3.txt +349 -0
  82. sage/ext_data/kenzo/CP4.txt +4774 -0
  83. sage/ext_data/kenzo/README.txt +49 -0
  84. sage/ext_data/kenzo/S4.txt +20 -0
  85. sage/graphs/all.py +42 -0
  86. sage/graphs/asteroidal_triples.cpython-39-aarch64-linux-gnu.so +0 -0
  87. sage/graphs/asteroidal_triples.pyx +299 -0
  88. sage/graphs/base/all.py +1 -0
  89. sage/graphs/base/boost_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  90. sage/graphs/base/boost_graph.pxd +106 -0
  91. sage/graphs/base/boost_graph.pyx +3045 -0
  92. sage/graphs/base/c_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  93. sage/graphs/base/c_graph.pxd +106 -0
  94. sage/graphs/base/c_graph.pyx +5096 -0
  95. sage/graphs/base/dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  96. sage/graphs/base/dense_graph.pxd +26 -0
  97. sage/graphs/base/dense_graph.pyx +757 -0
  98. sage/graphs/base/graph_backends.cpython-39-aarch64-linux-gnu.so +0 -0
  99. sage/graphs/base/graph_backends.pxd +5 -0
  100. sage/graphs/base/graph_backends.pyx +797 -0
  101. sage/graphs/base/overview.py +85 -0
  102. sage/graphs/base/sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  103. sage/graphs/base/sparse_graph.pxd +90 -0
  104. sage/graphs/base/sparse_graph.pyx +1653 -0
  105. sage/graphs/base/static_dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  106. sage/graphs/base/static_dense_graph.pxd +5 -0
  107. sage/graphs/base/static_dense_graph.pyx +1032 -0
  108. sage/graphs/base/static_sparse_backend.cpython-39-aarch64-linux-gnu.so +0 -0
  109. sage/graphs/base/static_sparse_backend.pxd +27 -0
  110. sage/graphs/base/static_sparse_backend.pyx +1580 -0
  111. sage/graphs/base/static_sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  112. sage/graphs/base/static_sparse_graph.pxd +37 -0
  113. sage/graphs/base/static_sparse_graph.pyx +1304 -0
  114. sage/graphs/bipartite_graph.py +2709 -0
  115. sage/graphs/centrality.cpython-39-aarch64-linux-gnu.so +0 -0
  116. sage/graphs/centrality.pyx +965 -0
  117. sage/graphs/cographs.py +519 -0
  118. sage/graphs/comparability.cpython-39-aarch64-linux-gnu.so +0 -0
  119. sage/graphs/comparability.pyx +813 -0
  120. sage/graphs/connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  121. sage/graphs/connectivity.pxd +157 -0
  122. sage/graphs/connectivity.pyx +4813 -0
  123. sage/graphs/convexity_properties.cpython-39-aarch64-linux-gnu.so +0 -0
  124. sage/graphs/convexity_properties.pxd +16 -0
  125. sage/graphs/convexity_properties.pyx +827 -0
  126. sage/graphs/digraph.py +4410 -0
  127. sage/graphs/digraph_generators.py +1921 -0
  128. sage/graphs/distances_all_pairs.cpython-39-aarch64-linux-gnu.so +0 -0
  129. sage/graphs/distances_all_pairs.pxd +12 -0
  130. sage/graphs/distances_all_pairs.pyx +2938 -0
  131. sage/graphs/domination.py +1363 -0
  132. sage/graphs/dot2tex_utils.py +100 -0
  133. sage/graphs/edge_connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  134. sage/graphs/edge_connectivity.pyx +1215 -0
  135. sage/graphs/generators/all.py +1 -0
  136. sage/graphs/generators/basic.py +1769 -0
  137. sage/graphs/generators/chessboard.py +538 -0
  138. sage/graphs/generators/classical_geometries.py +1611 -0
  139. sage/graphs/generators/degree_sequence.py +235 -0
  140. sage/graphs/generators/distance_regular.cpython-39-aarch64-linux-gnu.so +0 -0
  141. sage/graphs/generators/distance_regular.pyx +2846 -0
  142. sage/graphs/generators/families.py +4749 -0
  143. sage/graphs/generators/intersection.py +565 -0
  144. sage/graphs/generators/platonic_solids.py +262 -0
  145. sage/graphs/generators/random.py +2623 -0
  146. sage/graphs/generators/smallgraphs.py +5741 -0
  147. sage/graphs/generators/world_map.py +724 -0
  148. sage/graphs/generic_graph.py +26395 -0
  149. sage/graphs/generic_graph_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  150. sage/graphs/generic_graph_pyx.pxd +34 -0
  151. sage/graphs/generic_graph_pyx.pyx +1626 -0
  152. sage/graphs/genus.cpython-39-aarch64-linux-gnu.so +0 -0
  153. sage/graphs/genus.pyx +623 -0
  154. sage/graphs/graph.py +9362 -0
  155. sage/graphs/graph_coloring.cpython-39-aarch64-linux-gnu.so +0 -0
  156. sage/graphs/graph_coloring.pyx +2284 -0
  157. sage/graphs/graph_database.py +1122 -0
  158. sage/graphs/graph_decompositions/all.py +1 -0
  159. sage/graphs/graph_decompositions/bandwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  160. sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
  161. sage/graphs/graph_decompositions/clique_separators.cpython-39-aarch64-linux-gnu.so +0 -0
  162. sage/graphs/graph_decompositions/clique_separators.pyx +595 -0
  163. sage/graphs/graph_decompositions/cutwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  164. sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
  165. sage/graphs/graph_decompositions/fast_digraph.cpython-39-aarch64-linux-gnu.so +0 -0
  166. sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
  167. sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
  168. sage/graphs/graph_decompositions/graph_products.cpython-39-aarch64-linux-gnu.so +0 -0
  169. sage/graphs/graph_decompositions/graph_products.pyx +462 -0
  170. sage/graphs/graph_decompositions/modular_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  171. sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
  172. sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
  173. sage/graphs/graph_decompositions/slice_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  174. sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
  175. sage/graphs/graph_decompositions/slice_decomposition.pyx +1080 -0
  176. sage/graphs/graph_decompositions/tree_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  177. sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
  178. sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
  179. sage/graphs/graph_decompositions/vertex_separation.cpython-39-aarch64-linux-gnu.so +0 -0
  180. sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
  181. sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
  182. sage/graphs/graph_editor.py +82 -0
  183. sage/graphs/graph_generators.py +3301 -0
  184. sage/graphs/graph_generators_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  185. sage/graphs/graph_generators_pyx.pyx +95 -0
  186. sage/graphs/graph_input.py +812 -0
  187. sage/graphs/graph_latex.py +2064 -0
  188. sage/graphs/graph_list.py +367 -0
  189. sage/graphs/graph_plot.py +1749 -0
  190. sage/graphs/graph_plot_js.py +338 -0
  191. sage/graphs/hyperbolicity.cpython-39-aarch64-linux-gnu.so +0 -0
  192. sage/graphs/hyperbolicity.pyx +1702 -0
  193. sage/graphs/hypergraph_generators.py +364 -0
  194. sage/graphs/independent_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  195. sage/graphs/independent_sets.pxd +13 -0
  196. sage/graphs/independent_sets.pyx +402 -0
  197. sage/graphs/isgci.py +1033 -0
  198. sage/graphs/isoperimetric_inequalities.cpython-39-aarch64-linux-gnu.so +0 -0
  199. sage/graphs/isoperimetric_inequalities.pyx +453 -0
  200. sage/graphs/line_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  201. sage/graphs/line_graph.pyx +627 -0
  202. sage/graphs/lovasz_theta.py +77 -0
  203. sage/graphs/matching.py +1633 -0
  204. sage/graphs/matching_covered_graph.py +3566 -0
  205. sage/graphs/orientations.py +1504 -0
  206. sage/graphs/partial_cube.py +459 -0
  207. sage/graphs/path_enumeration.cpython-39-aarch64-linux-gnu.so +0 -0
  208. sage/graphs/path_enumeration.pyx +2040 -0
  209. sage/graphs/pq_trees.py +1129 -0
  210. sage/graphs/print_graphs.py +201 -0
  211. sage/graphs/schnyder.py +865 -0
  212. sage/graphs/spanning_tree.cpython-39-aarch64-linux-gnu.so +0 -0
  213. sage/graphs/spanning_tree.pyx +1457 -0
  214. sage/graphs/strongly_regular_db.cpython-39-aarch64-linux-gnu.so +0 -0
  215. sage/graphs/strongly_regular_db.pyx +3340 -0
  216. sage/graphs/traversals.cpython-39-aarch64-linux-gnu.so +0 -0
  217. sage/graphs/traversals.pxd +9 -0
  218. sage/graphs/traversals.pyx +1871 -0
  219. sage/graphs/trees.cpython-39-aarch64-linux-gnu.so +0 -0
  220. sage/graphs/trees.pxd +15 -0
  221. sage/graphs/trees.pyx +310 -0
  222. sage/graphs/tutte_polynomial.py +713 -0
  223. sage/graphs/views.cpython-39-aarch64-linux-gnu.so +0 -0
  224. sage/graphs/views.pyx +794 -0
  225. sage/graphs/weakly_chordal.cpython-39-aarch64-linux-gnu.so +0 -0
  226. sage/graphs/weakly_chordal.pyx +562 -0
  227. sage/groups/all__sagemath_graphs.py +1 -0
  228. sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
  229. sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
  230. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-aarch64-linux-gnu.so +0 -0
  231. sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
  232. sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
  233. sage/knots/all.py +6 -0
  234. sage/knots/free_knotinfo_monoid.py +507 -0
  235. sage/knots/gauss_code.py +291 -0
  236. sage/knots/knot.py +682 -0
  237. sage/knots/knot_table.py +284 -0
  238. sage/knots/knotinfo.py +2880 -0
  239. sage/knots/link.py +4682 -0
  240. sage/sandpiles/all.py +13 -0
  241. sage/sandpiles/examples.py +225 -0
  242. sage/sandpiles/sandpile.py +6365 -0
  243. sage/topology/all.py +22 -0
  244. sage/topology/cell_complex.py +1214 -0
  245. sage/topology/cubical_complex.py +1977 -0
  246. sage/topology/delta_complex.py +1806 -0
  247. sage/topology/filtered_simplicial_complex.py +744 -0
  248. sage/topology/moment_angle_complex.py +823 -0
  249. sage/topology/simplicial_complex.py +5161 -0
  250. sage/topology/simplicial_complex_catalog.py +86 -0
  251. sage/topology/simplicial_complex_examples.py +1692 -0
  252. sage/topology/simplicial_complex_homset.py +205 -0
  253. sage/topology/simplicial_complex_morphism.py +836 -0
  254. sage/topology/simplicial_set.py +4102 -0
  255. sage/topology/simplicial_set_catalog.py +55 -0
  256. sage/topology/simplicial_set_constructions.py +2954 -0
  257. sage/topology/simplicial_set_examples.py +865 -0
  258. sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,534 @@
1
+ # sage_setup: distribution = sagemath-graphs
2
+ r"""
3
+ Covering designs: coverings of `t`-element subsets of a `v`-set by `k`-sets
4
+
5
+ A `(v, k, t)` covering design `C` is an incidence structure consisting of a
6
+ set of points `P` of order `v`, and a set of blocks `B`, where each
7
+ block contains `k` points of `P`. Every `t`-element subset of `P`
8
+ must be contained in at least one block.
9
+
10
+ If every `t`-set is contained in exactly one block of `C`, then we
11
+ have a block design. Following the block design implementation, the
12
+ standard representation of a covering design uses `P = [0, 1, ..., v-1]`.
13
+
14
+ In addition to the parameters and incidence structure for a covering
15
+ design from this database, we include extra information:
16
+
17
+ * Best known lower bound on the size of a `(v, k, t)`-covering design
18
+ * Name of the person(s) who produced the design
19
+ * Method of construction used
20
+ * Date when the design was added to the database
21
+
22
+ REFERENCES:
23
+
24
+ .. [1] La Jolla Covering Repository,
25
+ https://dmgordon.org/cover
26
+
27
+ .. [2] Daniel M. Gordon and Douglas R. Stinson, *Coverings*,
28
+ Chapter 1 in: Charles J. Colbourn and Jeffrey H. Dinitz,
29
+ *Handbook of Combinatorial Designs*, 2nd Edition, 2006.
30
+ https://www.dmgordon.org/papers/hcd.pdf
31
+
32
+ AUTHORS:
33
+
34
+ - Daniel M. Gordon (2008-12-22): initial version
35
+
36
+ Classes and methods
37
+ -------------------
38
+ """
39
+ # ****************************************************************************
40
+ # Copyright (C) 2008 Daniel M. Gordon <dmgordo@gmail.com>
41
+ #
42
+ # Distributed under the terms of the GNU General Public License (GPL)
43
+ #
44
+ # The full text of the GPL is available at:
45
+ #
46
+ # https://www.gnu.org/licenses/
47
+ # ****************************************************************************
48
+
49
+ from urllib.request import urlopen
50
+ from ssl import create_default_context as default_context
51
+
52
+ from sage.structure.sage_object import SageObject
53
+ from sage.rings.rational import Rational
54
+ from sage.arith.misc import binomial
55
+ from sage.combinat.combination import Combinations
56
+ from sage.combinat.designs.incidence_structures import IncidenceStructure
57
+ from sage.cpython.string import bytes_to_str
58
+
59
+
60
+ def schonheim(v, k, t):
61
+ r"""
62
+ Return the Schonheim lower bound for the size of such a covering design.
63
+
64
+ INPUT:
65
+
66
+ - ``v`` -- integer; size of point set
67
+
68
+ - ``k`` -- integer; cardinality of each block
69
+
70
+ - ``t`` -- integer; cardinality of sets being covered
71
+
72
+ OUTPUT:
73
+
74
+ The Schonheim lower bound for such a covering design's size:
75
+ `C(v, k, t) \leq \lceil(\frac{v}{k} \lceil \frac{v-1}{k-1} \cdots
76
+ \lceil \frac{v-t+1}{k-t+1} \rceil \cdots \rceil \rceil`
77
+
78
+ EXAMPLES::
79
+
80
+ sage: from sage.combinat.designs.covering_design import schonheim
81
+ sage: schonheim(10, 3, 2)
82
+ 17
83
+ sage: schonheim(32, 16, 8)
84
+ 930
85
+ """
86
+ bound = 1
87
+ for i in range(t - 1, -1, -1):
88
+ bound = Rational((bound * (v - i), k - i)).ceil()
89
+ return bound
90
+
91
+
92
+ def trivial_covering_design(v, k, t):
93
+ r"""
94
+ Construct a trivial covering design.
95
+
96
+ INPUT:
97
+
98
+ - ``v`` -- integer; size of point set
99
+
100
+ - ``k`` -- integer; cardinality of each block
101
+
102
+ - ``t`` -- integer; cardinality of sets being covered
103
+
104
+ OUTPUT:
105
+
106
+ A trivial `(v, k, t)` covering design
107
+
108
+ EXAMPLES::
109
+
110
+ sage: C = trivial_covering_design(8, 3, 1)
111
+ sage: print(C)
112
+ C(8, 3, 1) = 3
113
+ Method: Trivial
114
+ 0 1 2
115
+ 0 6 7
116
+ 3 4 5
117
+ sage: C = trivial_covering_design(5, 3, 2)
118
+ sage: print(C)
119
+ 4 <= C(5, 3, 2) <= 10
120
+ Method: Trivial
121
+ 0 1 2
122
+ 0 1 3
123
+ 0 1 4
124
+ 0 2 3
125
+ 0 2 4
126
+ 0 3 4
127
+ 1 2 3
128
+ 1 2 4
129
+ 1 3 4
130
+ 2 3 4
131
+
132
+ .. NOTE::
133
+
134
+ Cases are:
135
+
136
+ * `t=0`: This could be empty, but it's a useful convention to have
137
+ one block (which is empty if `k=0`).
138
+
139
+ * `t=1` : This contains `\lceil v/k \rceil` blocks:
140
+ `[0, ..., k-1], [k, ..., 2k-1], ...`. The last block wraps around if
141
+ `k` does not divide `v`.
142
+
143
+ * anything else: Just use every `k`-subset of `[0, 1,..., v-1]`.
144
+ """
145
+ if t == 0: # single block [0, ..., k-1]
146
+ blk = list(range(k))
147
+ return CoveringDesign(v, k, t, 1, range(v), [blk], 1, "Trivial")
148
+ if t == 1: # blocks [0, ..., k-1], [k, ..., 2k-1], ...
149
+ size = Rational((v, k)).ceil()
150
+ blocks = [list(range(i * k, (i + 1) * k))
151
+ for i in range(size - 1)]
152
+ # last block: if k does not divide v, wrap around
153
+ blk = list(range((size - 1) * k, v))
154
+ for j in range(k - len(blk)):
155
+ blk.append(j)
156
+ blk.sort()
157
+ blocks.append(blk)
158
+ return CoveringDesign(v, k, t, size, range(v), blocks, size, "Trivial")
159
+ # default case, all k-subsets
160
+ return CoveringDesign(v, k, t, binomial(v, k), range(v),
161
+ Combinations(range(v), k), schonheim(v, k, t),
162
+ "Trivial")
163
+
164
+
165
+ class CoveringDesign(SageObject):
166
+ """
167
+ Covering design.
168
+
169
+ INPUT:
170
+
171
+ - ``v``, ``k``, ``t`` -- integer parameters of the covering design
172
+
173
+ - ``size`` -- integer
174
+
175
+ - ``points`` -- list of points (default: `[0, ..., v-1]`)
176
+
177
+ - ``blocks``
178
+
179
+ - ``low_bd`` -- integer; lower bound for such a design
180
+
181
+ - ``method``, ``creator``, ``timestamp`` -- database information
182
+ """
183
+
184
+ def __init__(self, v=0, k=0, t=0, size=0, points=None, blocks=None,
185
+ low_bd=0, method='', creator='', timestamp=''):
186
+ """
187
+ EXAMPLES::
188
+
189
+ sage: C = CoveringDesign(5, 4, 3, 4, range(5), [[0, 1, 2, 3],
190
+ ....: [0, 1, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4]], 4,
191
+ ....: 'Lexicographic Covering')
192
+ sage: print(C)
193
+ C(5, 4, 3) = 4
194
+ Method: Lexicographic Covering
195
+ 0 1 2 3
196
+ 0 1 2 4
197
+ 0 1 3 4
198
+ 0 2 3 4
199
+ """
200
+ self.__v = v
201
+ self.__k = k
202
+ self.__t = t
203
+ self.__size = size
204
+ if low_bd > 0:
205
+ self.__low_bd = low_bd
206
+ else:
207
+ self.__low_bd = schonheim(v, k, t)
208
+ self.__method = method
209
+ self.__creator = creator
210
+ self.__timestamp = timestamp
211
+ if points is None:
212
+ points = []
213
+ if blocks is None:
214
+ blocks = []
215
+ self.__incidence_structure = IncidenceStructure(points, blocks)
216
+
217
+ def __repr__(self):
218
+ """
219
+ Return the representation of this covering design.
220
+
221
+ This has the parameters but not the blocks.
222
+
223
+ EXAMPLES::
224
+
225
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
226
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
227
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
228
+ sage: C
229
+ (7, 3, 2)-covering design of size 7
230
+ Lower bound: 7
231
+ Method: Projective Plane
232
+ """
233
+ repr = ('(%d, %d, %d)-covering design of size %d\n'
234
+ % (self.__v, self.__k, self.__t, self.__size))
235
+ repr += 'Lower bound: %d\n' % (self.__low_bd)
236
+ if self.__creator:
237
+ repr += 'Created by: %s\n' % (self.__creator)
238
+ if self.__method:
239
+ repr += 'Method: %s\n' % (self.__method)
240
+ if self.__timestamp:
241
+ repr += 'Submitted on: %s\n' % (self.__timestamp)
242
+ return repr[:-1]
243
+
244
+ def __str__(self):
245
+ """
246
+ Return the string for this covering design.
247
+
248
+ This has the parameters and the blocks in readable form.
249
+
250
+ EXAMPLES::
251
+
252
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
253
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
254
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
255
+ sage: print(C)
256
+ C(7, 3, 2) = 7
257
+ Method: Projective Plane
258
+ 0 1 2
259
+ 0 3 4
260
+ 0 5 6
261
+ 1 3 5
262
+ 1 4 6
263
+ 2 3 6
264
+ 2 4 5
265
+ """
266
+ if self.__size == self.__low_bd: # check if covering is optimal
267
+ repr = ('C(%d, %d, %d) = %d\n' %
268
+ (self.__v, self.__k, self.__t, self.__size))
269
+ else:
270
+ repr = ('%d <= C(%d, %d, %d) <= %d\n' % (self.__low_bd,
271
+ self.__v, self.__k, self.__t, self.__size))
272
+ if self.__creator:
273
+ repr += 'Created by: %s\n' % (self.__creator)
274
+ if self.__method:
275
+ repr += 'Method: %s\n' % (self.__method)
276
+ if self.__timestamp:
277
+ repr += 'Submitted on: %s\n' % (self.__timestamp)
278
+ return repr + '\n'.join(' '.join(str(k) for k in block) for block in
279
+ self.__incidence_structure.blocks())
280
+
281
+ def is_covering(self):
282
+ """
283
+ Check all `t`-sets are in fact covered by the blocks of ``self``.
284
+
285
+ .. NOTE::
286
+
287
+ This is very slow and wasteful of memory.
288
+
289
+ EXAMPLES::
290
+
291
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
292
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
293
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
294
+ sage: C.is_covering()
295
+ True
296
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
297
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6],
298
+ ....: [2, 4, 6]], 0, 'not a covering') # last block altered
299
+ sage: C.is_covering()
300
+ False
301
+ """
302
+ v = self.__v
303
+ k = self.__k
304
+ t = self.__t
305
+ Svt = Combinations(range(v), t)
306
+ Skt = Combinations(range(k), t)
307
+ tset = {} # tables of t-sets: False = uncovered, True = covered
308
+ for i in Svt:
309
+ tset[tuple(i)] = False
310
+ # mark all t-sets covered by each block
311
+ for a in self.__incidence_structure.blocks():
312
+ for z in Skt:
313
+ y = (a[x] for x in z)
314
+ tset[tuple(y)] = True
315
+ for i in Svt:
316
+ if not tset[tuple(i)]: # uncovered
317
+ return False
318
+ return True # everything was covered
319
+
320
+ def v(self):
321
+ """
322
+ Return `v`, the number of points in the covering design.
323
+
324
+ EXAMPLES::
325
+
326
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
327
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
328
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
329
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
330
+ sage: C.v()
331
+ 7
332
+ """
333
+ return self.__v
334
+
335
+ def k(self):
336
+ """
337
+ Return `k`, the size of blocks of the covering design.
338
+
339
+ EXAMPLES::
340
+
341
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
342
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
343
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
344
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
345
+ sage: C.k()
346
+ 3
347
+ """
348
+ return self.__k
349
+
350
+ def t(self):
351
+ """
352
+ Return `t`, the size of sets which must be covered by the
353
+ blocks of the covering design
354
+
355
+ EXAMPLES::
356
+
357
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
358
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
359
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
360
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
361
+ sage: C.t()
362
+ 2
363
+ """
364
+ return self.__t
365
+
366
+ def size(self):
367
+ """
368
+ Return the number of blocks in the covering design.
369
+
370
+ EXAMPLES::
371
+
372
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
373
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
374
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
375
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
376
+ sage: C.size()
377
+ 7
378
+ """
379
+ return self.__size
380
+
381
+ def low_bd(self):
382
+ """
383
+ Return a lower bound for the number of blocks a covering
384
+ design with these parameters could have.
385
+
386
+ Typically this is the Schonheim bound, but for some parameters
387
+ better bounds have been shown.
388
+
389
+ EXAMPLES::
390
+
391
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
392
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
393
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
394
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
395
+ sage: C.low_bd()
396
+ 7
397
+ """
398
+ return self.__low_bd
399
+
400
+ def method(self):
401
+ """
402
+ Return the method used to create the covering design.
403
+
404
+ This field is optional, and is used in a database to give information
405
+ about how coverings were constructed.
406
+
407
+ EXAMPLES::
408
+
409
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
410
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
411
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
412
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
413
+ sage: C.method()
414
+ 'Projective Plane'
415
+ """
416
+ return self.__method
417
+
418
+ def creator(self):
419
+ """
420
+ Return the creator of the covering design.
421
+
422
+ This field is optional, and is used in a database to give
423
+ attribution for the covering design It can refer to the person
424
+ who submitted it, or who originally gave a construction
425
+
426
+ EXAMPLES::
427
+
428
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
429
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
430
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6],
431
+ ....: [2, 4, 5]],0, 'Projective Plane', 'Gino Fano')
432
+ sage: C.creator()
433
+ 'Gino Fano'
434
+ """
435
+ return self.__creator
436
+
437
+ def timestamp(self):
438
+ """
439
+ Return the time that the covering was submitted to the database.
440
+
441
+ EXAMPLES::
442
+
443
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
444
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
445
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
446
+ ....: [2, 3, 6], [2, 4, 5]],0, 'Projective Plane',
447
+ ....: 'Gino Fano', '1892-01-01 00:00:00')
448
+ sage: C.timestamp() # No exact date known; in Fano's 1892 article
449
+ '1892-01-01 00:00:00'
450
+ """
451
+ return self.__timestamp
452
+
453
+ def incidence_structure(self):
454
+ """
455
+ Return the incidence structure of this design, without extra parameters.
456
+
457
+ EXAMPLES::
458
+
459
+ sage: from sage.combinat.designs.covering_design import CoveringDesign
460
+ sage: C = CoveringDesign(7, 3, 2, 7, range(7), [[0, 1, 2],
461
+ ....: [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6],
462
+ ....: [2, 3, 6], [2, 4, 5]], 0, 'Projective Plane')
463
+ sage: D = C.incidence_structure()
464
+ sage: D.ground_set()
465
+ [0, 1, 2, 3, 4, 5, 6]
466
+ sage: D.blocks()
467
+ [[0, 1, 2], [0, 3, 4], [0, 5, 6], [1, 3, 5],
468
+ [1, 4, 6], [2, 3, 6], [2, 4, 5]]
469
+ """
470
+ return self.__incidence_structure
471
+
472
+
473
+ def best_known_covering_design_www(v, k, t, verbose=False):
474
+ r"""
475
+ Return the best known `(v, k, t)` covering design from an online database.
476
+
477
+ This uses the La Jolla Covering Repository, a database
478
+ available at `<https://ljcr.dmgordon.org/cover.html>`_
479
+
480
+ INPUT:
481
+
482
+ - ``v`` -- integer; the size of the point set for the design
483
+
484
+ - ``k`` -- integer; the number of points per block
485
+
486
+ - ``t`` -- integer; the size of sets covered by the blocks
487
+
488
+ - ``verbose`` -- boolean (default: ``False``); print verbose message
489
+
490
+ OUTPUT:
491
+
492
+ A :class:`CoveringDesign` object representing the ``(v, k, t)``-covering
493
+ design with smallest number of blocks available in the database.
494
+
495
+ EXAMPLES::
496
+
497
+ sage: from sage.combinat.designs.covering_design import ( # optional - internet
498
+ ....: best_known_covering_design_www)
499
+ sage: C = best_known_covering_design_www(7, 3, 2) # optional - internet
500
+ sage: print(C) # optional - internet
501
+ C(7, 3, 2) = 7
502
+ Method: lex covering
503
+ Submitted on: 1996-12-01 00:00:00
504
+ 0 1 2
505
+ 0 3 4
506
+ 0 5 6
507
+ 1 3 5
508
+ 1 4 6
509
+ 2 3 6
510
+ 2 4 5
511
+
512
+ A :exc:`ValueError` is raised if the ``(v, k, t)`` parameters are not
513
+ found in the database.
514
+ """
515
+ from sage.misc.sage_eval import sage_eval
516
+
517
+ v = int(v)
518
+ k = int(k)
519
+ t = int(t)
520
+ param = "?v=%s&k=%s&t=%s" % (v, k, t)
521
+ url = "https://ljcr.dmgordon.org/get_cover.php" + param
522
+ if verbose:
523
+ print("Looking up the bounds at %s" % url)
524
+
525
+ f = urlopen(url, context=default_context())
526
+ try:
527
+ s = bytes_to_str(f.read())
528
+ finally:
529
+ f.close()
530
+
531
+ if 'covering not in database' in s: # not found
532
+ str = "no (%d, %d, %d) covering design in database\n" % (v, k, t)
533
+ raise ValueError(str)
534
+ return sage_eval(s)