passagemath-graphs 10.6.1rc1__cp310-cp310-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.
- passagemath_graphs-10.6.1rc1.dist-info/METADATA +292 -0
- passagemath_graphs-10.6.1rc1.dist-info/RECORD +260 -0
- passagemath_graphs-10.6.1rc1.dist-info/WHEEL +5 -0
- passagemath_graphs-10.6.1rc1.dist-info/top_level.txt +2 -0
- passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
- passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
- passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
- sage/all__sagemath_graphs.py +39 -0
- sage/combinat/abstract_tree.py +2723 -0
- sage/combinat/all__sagemath_graphs.py +34 -0
- sage/combinat/binary_tree.py +5306 -0
- sage/combinat/cluster_algebra_quiver/all.py +22 -0
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
- sage/combinat/cluster_algebra_quiver/interact.py +124 -0
- sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
- sage/combinat/cluster_algebra_quiver/mutation_type.py +1555 -0
- sage/combinat/cluster_algebra_quiver/quiver.py +2290 -0
- sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
- sage/combinat/designs/MOLS_handbook_data.py +570 -0
- sage/combinat/designs/all.py +58 -0
- sage/combinat/designs/bibd.py +1655 -0
- sage/combinat/designs/block_design.py +1071 -0
- sage/combinat/designs/covering_array.py +269 -0
- sage/combinat/designs/covering_design.py +530 -0
- sage/combinat/designs/database.py +5615 -0
- sage/combinat/designs/design_catalog.py +122 -0
- sage/combinat/designs/designs_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/designs_pyx.pxd +21 -0
- sage/combinat/designs/designs_pyx.pyx +993 -0
- sage/combinat/designs/difference_family.py +3951 -0
- sage/combinat/designs/difference_matrices.py +279 -0
- sage/combinat/designs/evenly_distributed_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
- sage/combinat/designs/ext_rep.py +1064 -0
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
- sage/combinat/designs/group_divisible_designs.py +361 -0
- sage/combinat/designs/incidence_structures.py +2357 -0
- sage/combinat/designs/latin_squares.py +581 -0
- sage/combinat/designs/orthogonal_arrays.py +2244 -0
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +967 -0
- sage/combinat/designs/resolvable_bibd.py +815 -0
- sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
- sage/combinat/designs/subhypergraph_search.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +530 -0
- sage/combinat/designs/twographs.py +306 -0
- sage/combinat/finite_state_machine.py +14874 -0
- sage/combinat/finite_state_machine_generators.py +2006 -0
- sage/combinat/graph_path.py +448 -0
- sage/combinat/interval_posets.py +3908 -0
- sage/combinat/nu_tamari_lattice.py +269 -0
- sage/combinat/ordered_tree.py +1446 -0
- sage/combinat/posets/all.py +46 -0
- sage/combinat/posets/bubble_shuffle.py +247 -0
- sage/combinat/posets/cartesian_product.py +493 -0
- sage/combinat/posets/d_complete.py +182 -0
- sage/combinat/posets/elements.py +273 -0
- sage/combinat/posets/forest.py +30 -0
- sage/combinat/posets/hasse_cython.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/hasse_cython.pyx +174 -0
- sage/combinat/posets/hasse_diagram.py +3672 -0
- sage/combinat/posets/hochschild_lattice.py +158 -0
- sage/combinat/posets/incidence_algebras.py +794 -0
- sage/combinat/posets/lattices.py +5117 -0
- sage/combinat/posets/linear_extension_iterator.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +292 -0
- sage/combinat/posets/linear_extensions.py +1037 -0
- sage/combinat/posets/mobile.py +275 -0
- sage/combinat/posets/moebius_algebra.py +776 -0
- sage/combinat/posets/poset_examples.py +2178 -0
- sage/combinat/posets/posets.py +9360 -0
- sage/combinat/rooted_tree.py +1070 -0
- sage/combinat/shard_order.py +239 -0
- sage/combinat/tamari_lattices.py +384 -0
- sage/combinat/yang_baxter_graph.py +923 -0
- sage/databases/all__sagemath_graphs.py +1 -0
- sage/databases/knotinfo_db.py +1231 -0
- sage/ext_data/all__sagemath_graphs.py +1 -0
- sage/ext_data/graphs/graph_plot_js.html +330 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/graphs/all.py +42 -0
- sage/graphs/asteroidal_triples.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/asteroidal_triples.pyx +320 -0
- sage/graphs/base/all.py +1 -0
- sage/graphs/base/boost_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/boost_graph.pxd +106 -0
- sage/graphs/base/boost_graph.pyx +3045 -0
- sage/graphs/base/c_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/c_graph.pxd +106 -0
- sage/graphs/base/c_graph.pyx +5096 -0
- sage/graphs/base/dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/dense_graph.pxd +28 -0
- sage/graphs/base/dense_graph.pyx +801 -0
- sage/graphs/base/graph_backends.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/graph_backends.pxd +5 -0
- sage/graphs/base/graph_backends.pyx +797 -0
- sage/graphs/base/overview.py +85 -0
- sage/graphs/base/sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/sparse_graph.pxd +90 -0
- sage/graphs/base/sparse_graph.pyx +1653 -0
- sage/graphs/base/static_dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_dense_graph.pxd +5 -0
- sage/graphs/base/static_dense_graph.pyx +1032 -0
- sage/graphs/base/static_sparse_backend.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_backend.pxd +27 -0
- sage/graphs/base/static_sparse_backend.pyx +1583 -0
- sage/graphs/base/static_sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_graph.pxd +37 -0
- sage/graphs/base/static_sparse_graph.pyx +1375 -0
- sage/graphs/bipartite_graph.py +2732 -0
- sage/graphs/centrality.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/centrality.pyx +1038 -0
- sage/graphs/cographs.py +519 -0
- sage/graphs/comparability.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/comparability.pyx +851 -0
- sage/graphs/connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/connectivity.pxd +157 -0
- sage/graphs/connectivity.pyx +4813 -0
- sage/graphs/convexity_properties.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/convexity_properties.pxd +16 -0
- sage/graphs/convexity_properties.pyx +870 -0
- sage/graphs/digraph.py +4754 -0
- sage/graphs/digraph_generators.py +1993 -0
- sage/graphs/distances_all_pairs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/distances_all_pairs.pxd +12 -0
- sage/graphs/distances_all_pairs.pyx +2938 -0
- sage/graphs/domination.py +1363 -0
- sage/graphs/dot2tex_utils.py +100 -0
- sage/graphs/edge_connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/edge_connectivity.pyx +1215 -0
- sage/graphs/generators/all.py +1 -0
- sage/graphs/generators/basic.py +1769 -0
- sage/graphs/generators/chessboard.py +538 -0
- sage/graphs/generators/classical_geometries.py +1611 -0
- sage/graphs/generators/degree_sequence.py +235 -0
- sage/graphs/generators/distance_regular.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generators/distance_regular.pyx +2846 -0
- sage/graphs/generators/families.py +4759 -0
- sage/graphs/generators/intersection.py +565 -0
- sage/graphs/generators/platonic_solids.py +262 -0
- sage/graphs/generators/random.py +2623 -0
- sage/graphs/generators/smallgraphs.py +5741 -0
- sage/graphs/generators/world_map.py +724 -0
- sage/graphs/generic_graph.py +26867 -0
- sage/graphs/generic_graph_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generic_graph_pyx.pxd +34 -0
- sage/graphs/generic_graph_pyx.pyx +1673 -0
- sage/graphs/genus.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/genus.pyx +622 -0
- sage/graphs/graph.py +9645 -0
- sage/graphs/graph_coloring.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_coloring.pyx +2284 -0
- sage/graphs/graph_database.py +1177 -0
- sage/graphs/graph_decompositions/all.py +1 -0
- sage/graphs/graph_decompositions/bandwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.pyx +616 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
- sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
- sage/graphs/graph_decompositions/graph_products.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/graph_products.pyx +508 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
- sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
- sage/graphs/graph_decompositions/slice_decomposition.pyx +1106 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
- sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
- sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
- sage/graphs/graph_editor.py +82 -0
- sage/graphs/graph_generators.py +3314 -0
- sage/graphs/graph_generators_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_generators_pyx.pyx +95 -0
- sage/graphs/graph_input.py +812 -0
- sage/graphs/graph_latex.py +2064 -0
- sage/graphs/graph_list.py +410 -0
- sage/graphs/graph_plot.py +1756 -0
- sage/graphs/graph_plot_js.py +338 -0
- sage/graphs/hyperbolicity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/hyperbolicity.pyx +1704 -0
- sage/graphs/hypergraph_generators.py +364 -0
- sage/graphs/independent_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/independent_sets.pxd +13 -0
- sage/graphs/independent_sets.pyx +402 -0
- sage/graphs/isgci.py +1033 -0
- sage/graphs/isoperimetric_inequalities.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/isoperimetric_inequalities.pyx +489 -0
- sage/graphs/line_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/line_graph.pyx +743 -0
- sage/graphs/lovasz_theta.py +77 -0
- sage/graphs/matching.py +1633 -0
- sage/graphs/matching_covered_graph.py +3590 -0
- sage/graphs/orientations.py +1489 -0
- sage/graphs/partial_cube.py +459 -0
- sage/graphs/path_enumeration.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/path_enumeration.pyx +2040 -0
- sage/graphs/pq_trees.py +1129 -0
- sage/graphs/print_graphs.py +201 -0
- sage/graphs/schnyder.py +865 -0
- sage/graphs/spanning_tree.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/spanning_tree.pyx +1457 -0
- sage/graphs/strongly_regular_db.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/strongly_regular_db.pyx +3340 -0
- sage/graphs/traversals.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/traversals.pxd +9 -0
- sage/graphs/traversals.pyx +1872 -0
- sage/graphs/trees.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/trees.pxd +15 -0
- sage/graphs/trees.pyx +310 -0
- sage/graphs/tutte_polynomial.py +713 -0
- sage/graphs/views.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/views.pyx +794 -0
- sage/graphs/weakly_chordal.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/weakly_chordal.pyx +604 -0
- sage/groups/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
- sage/knots/all.py +6 -0
- sage/knots/free_knotinfo_monoid.py +507 -0
- sage/knots/gauss_code.py +291 -0
- sage/knots/knot.py +682 -0
- sage/knots/knot_table.py +284 -0
- sage/knots/knotinfo.py +2900 -0
- sage/knots/link.py +4715 -0
- sage/sandpiles/all.py +13 -0
- sage/sandpiles/examples.py +225 -0
- sage/sandpiles/sandpile.py +6365 -0
- sage/topology/all.py +22 -0
- sage/topology/cell_complex.py +1214 -0
- sage/topology/cubical_complex.py +1976 -0
- sage/topology/delta_complex.py +1806 -0
- sage/topology/filtered_simplicial_complex.py +744 -0
- sage/topology/moment_angle_complex.py +823 -0
- sage/topology/simplicial_complex.py +5160 -0
- sage/topology/simplicial_complex_catalog.py +92 -0
- sage/topology/simplicial_complex_examples.py +1680 -0
- sage/topology/simplicial_complex_homset.py +205 -0
- sage/topology/simplicial_complex_morphism.py +836 -0
- sage/topology/simplicial_set.py +4102 -0
- sage/topology/simplicial_set_catalog.py +55 -0
- sage/topology/simplicial_set_constructions.py +2954 -0
- sage/topology/simplicial_set_examples.py +865 -0
- sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,269 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
r"""
|
3
|
+
Covering arrays
|
4
|
+
|
5
|
+
A covering array, denoted `CA(N;t,k,v)`, is an `N` by `k` array with
|
6
|
+
entries from a set of `v` elements with the property that in every
|
7
|
+
selection of `t` columns, every sequence of `t` elements appears in at
|
8
|
+
least one row.
|
9
|
+
|
10
|
+
An orthogonal array, denoted `OA(N;t,k,v)` is a covering array with the
|
11
|
+
property that every sequence of `t`-elements appears in exactly one row.
|
12
|
+
(See :mod:`sage.combinat.designs.orthogonal_arrays`).
|
13
|
+
|
14
|
+
This module collects methods relating to covering arrays, some of which
|
15
|
+
are inherited from orthogonal array methods. This module defines the
|
16
|
+
following functions:
|
17
|
+
|
18
|
+
.. csv-table::
|
19
|
+
:class: contentstable
|
20
|
+
:widths: 50, 50
|
21
|
+
:delim: |
|
22
|
+
|
23
|
+
:meth:`~sage.combinat.designs.designs_pyx.is_covering_array` | Check that an input list of lists is a `CA(N;t,k,v)`.
|
24
|
+
:meth:`~sage.combinat.designs.covering_array.CA_relabel` | Return a relabelled version of the `CA`.
|
25
|
+
:meth:`~sage.combinat.designs.covering_array.CA_standard_label` | Return a version of the `CA` relabelled to symbols `(0,\dots,n-1)`.
|
26
|
+
:meth:`~sage.combinat.designs.covering_array.truncate_columns` | Return an array with `k` columns from a larger one.
|
27
|
+
:meth:`~sage.combinat.designs.covering_array.Kleitman_Spencer_Katona` | Return a `CA(N; 2, k, 2)` using N as input.
|
28
|
+
:meth:`~sage.combinat.designs.covering_array.column_Kleitman_Spencer_Katona` | Return a `CA(N; 2, k, 2)` using k as input.
|
29
|
+
:meth:`~sage.combinat.designs.covering_array.database_check` | Check if CA can be made from the database of combinatorial designs.
|
30
|
+
:meth:`~sage.combinat.designs.covering_array.covering_array` | Return a `CA` with given parameters.
|
31
|
+
|
32
|
+
REFERENCES:
|
33
|
+
|
34
|
+
- [Colb2004]_
|
35
|
+
|
36
|
+
- [SMC2006]_
|
37
|
+
|
38
|
+
- [WC2007]_
|
39
|
+
|
40
|
+
AUTHORS:
|
41
|
+
|
42
|
+
- Aaron Dwyer and brett stevens (2022): initial version
|
43
|
+
"""
|
44
|
+
|
45
|
+
# **********************************************************************
|
46
|
+
# Copyright (C) 2022 Aaron Dwyer <aarondwyer@cmail.carleton.ca>
|
47
|
+
#
|
48
|
+
# This program is free software: you can redistribute it and/or modify
|
49
|
+
# it under the terms of the GNU General Public License as published by
|
50
|
+
# the Free Software Foundation, either version 2 of the License, or
|
51
|
+
# (at your option) any later version.
|
52
|
+
# https://www.gnu.org/licenses/
|
53
|
+
# **********************************************************************
|
54
|
+
|
55
|
+
from .orthogonal_arrays import OA_relabel, OA_standard_label
|
56
|
+
CA_relabel = OA_relabel
|
57
|
+
CA_standard_label = OA_standard_label
|
58
|
+
|
59
|
+
|
60
|
+
def truncate_columns(array, k):
|
61
|
+
r"""
|
62
|
+
Return a covering array with `k` columns, obtained by removing excess
|
63
|
+
columns from a larger covering array.
|
64
|
+
|
65
|
+
INPUT:
|
66
|
+
|
67
|
+
- ``array`` -- the array to be truncated.
|
68
|
+
|
69
|
+
- ``k`` -- the number of columns desired. Must be less than the
|
70
|
+
number of columns in ``array``.
|
71
|
+
|
72
|
+
EXAMPLES::
|
73
|
+
|
74
|
+
sage: from sage.combinat.designs.designs_pyx import is_covering_array
|
75
|
+
sage: from sage.combinat.designs.covering_array import truncate_columns
|
76
|
+
sage: from sage.combinat.designs.database import ca_11_2_5_3
|
77
|
+
sage: C = ca_11_2_5_3()
|
78
|
+
sage: D = truncate_columns(C,7)
|
79
|
+
Traceback (most recent call last):
|
80
|
+
...
|
81
|
+
ValueError: array only has 5 columns
|
82
|
+
sage: E = truncate_columns(C,4)
|
83
|
+
sage: is_covering_array(E,parameters=True)
|
84
|
+
(True, (11, 2, 4, 3))
|
85
|
+
|
86
|
+
"""
|
87
|
+
oldk = len(array[0])
|
88
|
+
|
89
|
+
if oldk == k:
|
90
|
+
return array
|
91
|
+
|
92
|
+
if oldk < k:
|
93
|
+
raise ValueError("array only has {} columns".format(oldk))
|
94
|
+
|
95
|
+
return [row[:k] for row in array]
|
96
|
+
|
97
|
+
|
98
|
+
def Kleitman_Spencer_Katona(N):
|
99
|
+
r"""
|
100
|
+
Return a `CA(N; 2, k, 2)` where `k = \binom {N-1}{\lceil N/2 \rceil}`.
|
101
|
+
|
102
|
+
INPUT:
|
103
|
+
|
104
|
+
- ``N`` -- the number of rows in the array, must be an integer greater
|
105
|
+
than 3 since any smaller would not produce enough columns for a
|
106
|
+
strength 2 array.
|
107
|
+
|
108
|
+
This construction is referenced in [Colb2004]_ from [KS1973]_ and [Kat1973]_
|
109
|
+
|
110
|
+
**Construction**
|
111
|
+
|
112
|
+
Take all distinct binary `N`-tuples of weight `N/2` that have a 0
|
113
|
+
in the first position and place them as columns in an array.
|
114
|
+
|
115
|
+
EXAMPLES::
|
116
|
+
|
117
|
+
sage: from sage.combinat.designs.covering_array import Kleitman_Spencer_Katona
|
118
|
+
sage: from sage.combinat.designs.designs_pyx import is_covering_array
|
119
|
+
sage: C = Kleitman_Spencer_Katona(2)
|
120
|
+
Traceback (most recent call last):
|
121
|
+
...
|
122
|
+
ValueError: N must be greater than 3
|
123
|
+
sage: C = Kleitman_Spencer_Katona(5)
|
124
|
+
sage: is_covering_array(C,parameters=True)
|
125
|
+
(True, (5, 2, 4, 2))
|
126
|
+
|
127
|
+
"""
|
128
|
+
from itertools import combinations
|
129
|
+
from sage.arith.misc import integer_ceil
|
130
|
+
if N < 4:
|
131
|
+
raise ValueError("N must be greater than 3")
|
132
|
+
|
133
|
+
col_list = []
|
134
|
+
for p in combinations(range(N-1), integer_ceil(N/2)):
|
135
|
+
S = [0]*N
|
136
|
+
for i in p:
|
137
|
+
S[i] = 1
|
138
|
+
col_list.append(S)
|
139
|
+
return [[col_list[j][i] for j in range(len(col_list))] for i in range(N)]
|
140
|
+
|
141
|
+
|
142
|
+
def column_Kleitman_Spencer_Katona(k):
|
143
|
+
r"""
|
144
|
+
Return a covering array with `k` columns using the Kleitman-Spencer-Katona
|
145
|
+
method.
|
146
|
+
|
147
|
+
See :func:`~sage.combinat.designs.covering_array.Kleitman_Spencer_Katona`
|
148
|
+
|
149
|
+
INPUT:
|
150
|
+
|
151
|
+
- ``k`` -- the number of columns in the array, must be an integer
|
152
|
+
greater than 3 since any smaller is a trivial array for strength 2.
|
153
|
+
|
154
|
+
EXAMPLES::
|
155
|
+
|
156
|
+
sage: from sage.combinat.designs.designs_pyx import is_covering_array
|
157
|
+
sage: from sage.combinat.designs.covering_array import column_Kleitman_Spencer_Katona
|
158
|
+
sage: C = column_Kleitman_Spencer_Katona(20)
|
159
|
+
sage: is_covering_array(C,parameters=True)
|
160
|
+
(True, (8, 2, 20, 2))
|
161
|
+
sage: column_Kleitman_Spencer_Katona(25000)
|
162
|
+
Traceback (most recent call last):
|
163
|
+
...
|
164
|
+
NotImplementedError: not implemented for k > 24310
|
165
|
+
|
166
|
+
"""
|
167
|
+
kdict = [(3, 4), (4, 5), (10, 6), (15, 7), (35, 8), (56, 9),
|
168
|
+
(126, 10), (210, 11), (462, 12), (792, 13), (1716, 14),
|
169
|
+
(3003, 15), (6435, 16), (11440, 17), (24310, 18)]
|
170
|
+
|
171
|
+
if k > kdict[-1][0]:
|
172
|
+
raise NotImplementedError("not implemented for k > {}".format(kdict[-1][0]))
|
173
|
+
|
174
|
+
for (ki, N) in kdict:
|
175
|
+
if k <= ki:
|
176
|
+
return truncate_columns(Kleitman_Spencer_Katona(N), k)
|
177
|
+
|
178
|
+
|
179
|
+
def database_check(number_columns, strength, levels):
|
180
|
+
r"""
|
181
|
+
Check if the database can be used to build a CA with the given parameters.
|
182
|
+
If so return the CA, if not return False.
|
183
|
+
|
184
|
+
INPUT:
|
185
|
+
|
186
|
+
- ``strength`` (integer) -- the parameter `t` of the covering array,
|
187
|
+
such that in any selection of `t` columns of the array, every
|
188
|
+
`t`-tuple appears at least once.
|
189
|
+
|
190
|
+
- ``levels`` (integer) -- the parameter `v` which is the number of
|
191
|
+
unique symbols that appear in the covering array.
|
192
|
+
|
193
|
+
- ``number_columns`` (integer) -- the number of columns desired for
|
194
|
+
the covering array.
|
195
|
+
|
196
|
+
EXAMPLES::
|
197
|
+
|
198
|
+
sage: from sage.combinat.designs.designs_pyx import is_covering_array
|
199
|
+
sage: from sage.combinat.designs.covering_array import database_check
|
200
|
+
sage: C = database_check(6, 2, 3)
|
201
|
+
sage: is_covering_array(C, parameters=True)
|
202
|
+
(True, (12, 2, 6, 3))
|
203
|
+
sage: database_check(6, 3, 3)
|
204
|
+
False
|
205
|
+
|
206
|
+
"""
|
207
|
+
import sage.combinat.designs.database as DB
|
208
|
+
|
209
|
+
if (strength, levels) in DB.CA_constructions:
|
210
|
+
for i in DB.CA_constructions[(strength, levels)]:
|
211
|
+
if number_columns <= i[1]:
|
212
|
+
CA = "ca_{}_{}_{}_{}".format(i[0], strength, i[1], levels)
|
213
|
+
f = getattr(DB, CA)
|
214
|
+
return truncate_columns(f(), number_columns)
|
215
|
+
return False
|
216
|
+
else:
|
217
|
+
return False
|
218
|
+
|
219
|
+
|
220
|
+
def covering_array(strength, number_columns, levels):
|
221
|
+
r"""
|
222
|
+
Build a `CA(N; t, k, v)` using direct constructions, where `N` is the
|
223
|
+
smallest size known.
|
224
|
+
|
225
|
+
INPUT:
|
226
|
+
|
227
|
+
- ``strength`` (integer) -- the parameter `t` of the covering array,
|
228
|
+
such that in any selection of `t` columns of the array, every
|
229
|
+
`t`-tuple appears at least once.
|
230
|
+
|
231
|
+
- ``levels`` (integer) -- the parameter `v` which is the number of
|
232
|
+
unique symbols that appear in the covering array.
|
233
|
+
|
234
|
+
- ``number_columns`` (integer) -- the number of columns desired for
|
235
|
+
the covering array.
|
236
|
+
|
237
|
+
EXAMPLES::
|
238
|
+
|
239
|
+
sage: from sage.combinat.designs.designs_pyx import is_covering_array
|
240
|
+
sage: from sage.combinat.designs.covering_array import covering_array
|
241
|
+
sage: C1 = covering_array(2, 7, 3)
|
242
|
+
sage: is_covering_array(C1, parameters=True)
|
243
|
+
(True, (12, 2, 7, 3))
|
244
|
+
sage: C2 = covering_array(2, 11, 2)
|
245
|
+
sage: is_covering_array(C2, parameters=True)
|
246
|
+
(True, (7, 2, 11, 2))
|
247
|
+
sage: C3 = covering_array(2, 8, 7) # needs sage.schemes
|
248
|
+
sage: is_covering_array(C3, parameters=True) # needs sage.schemes
|
249
|
+
(True, (49, 2, 8, 7))
|
250
|
+
sage: C4 = covering_array(2, 50, 7)
|
251
|
+
No direct construction known and/or implemented for a CA(N; 2, 50, 7)
|
252
|
+
|
253
|
+
"""
|
254
|
+
from sage.combinat.designs.orthogonal_arrays import orthogonal_array
|
255
|
+
|
256
|
+
if levels == 2 and strength == 2:
|
257
|
+
return column_Kleitman_Spencer_Katona(number_columns)
|
258
|
+
|
259
|
+
in_database = database_check(number_columns, strength, levels)
|
260
|
+
if in_database:
|
261
|
+
return in_database
|
262
|
+
|
263
|
+
if orthogonal_array(number_columns, levels, strength, existence=True) is True:
|
264
|
+
return orthogonal_array(number_columns, levels, strength)
|
265
|
+
|
266
|
+
else:
|
267
|
+
print("No direct construction known and/or implemented for a CA(N; {}, {}, {})".format(
|
268
|
+
strength, number_columns, levels))
|
269
|
+
return
|