@@ -160,15 +160,15 @@ def __init__(self, points=None, blocks=None, incidence_matrix=None,
160
160
We avoid to convert to integers when the points are not (but compare
161
161
equal to integers because of coercion)::
162
162
163
- sage: V = GF(5)
164
- sage: e0,e1,e2,e3,e4 = V
165
- sage: [e0,e1,e2,e3,e4] == list(range(5)) # coercion makes them equal
163
+ sage: V = GF(5) # optional - sage.rings.finite_rings
164
+ sage: e0,e1,e2,e3,e4 = V # optional - sage.rings.finite_rings
165
+ sage: [e0,e1,e2,e3,e4] == list(range(5)) # coercion makes them equal # optional - sage.rings.finite_rings
166
166
True
167
- sage: blocks = [[e0,e1,e2],[e0,e1],[e2,e4]]
168
- sage: I = IncidenceStructure(V, blocks)
169
- sage: type(I.ground_set()[0])
167
+ sage: blocks = [[e0,e1,e2],[e0,e1],[e2,e4]] # optional - sage.rings.finite_rings
168
+ sage: I = IncidenceStructure(V, blocks) # optional - sage.rings.finite_rings
169
+ sage: type(I.ground_set()[0]) # optional - sage.rings.finite_rings
170
170
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
171
- sage: type(I.blocks()[0][0])
171
+ sage: type(I.blocks()[0][0]) # optional - sage.rings.finite_rings
172
172
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
173
173
174
174
TESTS::
@@ -282,9 +282,9 @@ def __eq__(self, other):
282
282
283
283
sage: blocks = [[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]]
284
284
sage: BD1 = IncidenceStructure(7, blocks)
285
- sage: M = BD1.incidence_matrix()
286
- sage: BD2 = IncidenceStructure(incidence_matrix=M)
287
- sage: BD1 == BD2
285
+ sage: M = BD1.incidence_matrix() # optional - sage.modules
286
+ sage: BD2 = IncidenceStructure(incidence_matrix=M) # optional - sage.modules
287
+ sage: BD1 == BD2 # optional - sage.modules
288
288
True
289
289
290
290
sage: e1 = frozenset([0,1])
@@ -326,9 +326,9 @@ def __ne__(self, other):
326
326
EXAMPLES::
327
327
328
328
sage: BD1 = IncidenceStructure(7, [[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
329
- sage: M = BD1.incidence_matrix()
330
- sage: BD2 = IncidenceStructure(incidence_matrix=M)
331
- sage: BD1 != BD2
329
+ sage: M = BD1.incidence_matrix() # optional - sage.modules
330
+ sage: BD2 = IncidenceStructure(incidence_matrix=M) # optional - sage.modules
331
+ sage: BD1 != BD2 # optional - sage.modules
332
332
False
333
333
"""
334
334
return not self == other
@@ -363,10 +363,10 @@ def __contains__(self, block):
363
363
True
364
364
sage: ["Am", "I", "finally", "done ?"] in IS
365
365
False
366
- sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), point_coordinates=False)
367
- sage: [3,8,7] in IS
366
+ sage: IS = designs.ProjectiveGeometryDesign(3, 1, GF(2), point_coordinates=False) # optional - sage.rings.finite_rings
367
+ sage: [3,8,7] in IS # optional - sage.rings.finite_rings
368
368
True
369
- sage: [3,8,9] in IS
369
+ sage: [3,8,9] in IS # optional - sage.rings.finite_rings
370
370
False
371
371
"""
372
372
try :
@@ -1119,10 +1119,11 @@ def incidence_matrix(self):
1119
1119
1120
1120
EXAMPLES::
1121
1121
1122
- sage: BD = IncidenceStructure(7, [[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
1122
+ sage: BD = IncidenceStructure(7, [[0,1,2],[0,3,4],[0,5,6],[1,3,5],
1123
+ ....: [1,4,6],[2,3,6],[2,4,5]])
1123
1124
sage: BD.block_sizes()
1124
1125
[3, 3, 3, 3, 3, 3, 3]
1125
- sage: BD.incidence_matrix()
1126
+ sage: BD.incidence_matrix() # optional - sage.modules
1126
1127
[1 1 1 0 0 0 0]
1127
1128
[1 0 0 1 1 0 0]
1128
1129
[1 0 0 0 0 1 1]
@@ -1132,7 +1133,7 @@ def incidence_matrix(self):
1132
1133
[0 0 1 0 1 1 0]
1133
1134
1134
1135
sage: I = IncidenceStructure('abc', ('ab','abc','ac','c'))
1135
- sage: I.incidence_matrix()
1136
+ sage: I.incidence_matrix() # optional - sage.modules
1136
1137
[1 1 1 0]
1137
1138
[1 1 0 0]
1138
1139
[0 1 1 1]
@@ -1157,26 +1158,28 @@ def incidence_graph(self,labels=False):
1157
1158
- ``labels`` (boolean) -- whether to return a graph whose vertices are
1158
1159
integers, or labelled elements.
1159
1160
1160
- - ``labels is False`` (default) -- in this case the first vertices
1161
- of the graphs are the elements of :meth:`ground_set`, and appear
1162
- in the same order. Similarly, the following vertices represent the
1163
- elements of :meth:`blocks`, and appear in the same order.
1161
+ - ``labels is False`` (default) -- in this case the first vertices
1162
+ of the graphs are the elements of :meth:`ground_set`, and appear
1163
+ in the same order. Similarly, the following vertices represent the
1164
+ elements of :meth:`blocks`, and appear in the same order.
1164
1165
1165
- - ``labels is True``, the points keep their original labels, and the
1166
- blocks are :func:`Set <Set>` objects.
1166
+ - ``labels is True``, the points keep their original labels, and the
1167
+ blocks are :func:`Set <Set>` objects.
1167
1168
1168
- Note that the labelled incidence graph can be incorrect when
1169
- blocks are repeated, and on some (rare) occasions when the
1170
- elements of :meth:`ground_set` mix :func:`Set` and non-:func:`Set
1171
- <Set>` objects.
1169
+ Note that the labelled incidence graph can be incorrect when
1170
+ blocks are repeated, and on some (rare) occasions when the
1171
+ elements of :meth:`ground_set` mix :func:`Set` and non-:func:`Set
1172
+ <Set>` objects.
1172
1173
1173
1174
EXAMPLES::
1174
1175
1175
- sage: BD = IncidenceStructure(7, [[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
1176
+ sage: BD = IncidenceStructure(7, [[0,1,2],[0,3,4],[0,5,6],[1,3,5],
1177
+ ....: [1,4,6],[2,3,6],[2,4,5]])
1176
1178
sage: BD.incidence_graph()
1177
1179
Bipartite graph on 14 vertices
1178
- sage: A = BD.incidence_matrix()
1179
- sage: Graph(block_matrix([[A*0,A],[A.transpose(),A*0]])) == BD.incidence_graph()
1180
+ sage: A = BD.incidence_matrix() # optional - sage.modules
1181
+ sage: Graph(block_matrix([[A*0, A], # optional - sage.modules
1182
+ ....: [A.transpose(),A*0]])) == BD.incidence_graph()
1180
1183
True
1181
1184
1182
1185
TESTS:
@@ -1499,10 +1502,10 @@ def is_t_design(self, t=None, v=None, k=None, l=None, return_parameters=False):
1499
1502
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)
1500
1503
False
1501
1504
1502
- sage: BD = designs.AffineGeometryDesign(3, 1, GF(2))
1503
- sage: BD.is_t_design(1)
1505
+ sage: BD = designs.AffineGeometryDesign(3, 1, GF(2)) # optional - sage.rings.finite_rings
1506
+ sage: BD.is_t_design(1) # optional - sage.rings.finite_rings
1504
1507
True
1505
- sage: BD.is_t_design(2)
1508
+ sage: BD.is_t_design(2) # optional - sage.rings.finite_rings
1506
1509
True
1507
1510
1508
1511
Steiner triple and quadruple systems are other names for `2-(v,3,1)` and
@@ -1568,11 +1571,11 @@ def is_t_design(self, t=None, v=None, k=None, l=None, return_parameters=False):
1568
1571
[(8, 4, 7)]
1569
1572
sage: [(v,k,l) for v in R for k in R for l in R if S4_8.is_t_design(0,v,k,l)]
1570
1573
[(8, 4, 14)]
1571
- sage: A = designs.AffineGeometryDesign(3, 1, GF(2))
1572
- sage: A.is_t_design(return_parameters=True)
1574
+ sage: A = designs.AffineGeometryDesign(3, 1, GF(2)) # optional - sage.rings.finite_rings
1575
+ sage: A.is_t_design(return_parameters=True) # optional - sage.rings.finite_rings
1573
1576
(True, (2, 8, 2, 1))
1574
- sage: A = designs.AffineGeometryDesign(4, 2, GF(2))
1575
- sage: A.is_t_design(return_parameters=True)
1577
+ sage: A = designs.AffineGeometryDesign(4, 2, GF(2)) # optional - sage.rings.finite_rings
1578
+ sage: A.is_t_design(return_parameters=True) # optional - sage.rings.finite_rings
1576
1579
(True, (3, 16, 4, 1))
1577
1580
sage: I = IncidenceStructure(2, [])
1578
1581
sage: I.is_t_design(return_parameters=True)
@@ -1712,9 +1715,10 @@ def is_generalized_quadrangle(self, verbose=False, parameters=False):
1712
1715
False
1713
1716
1714
1717
sage: G = graphs.CycleGraph(5)
1715
- sage: B = list(G.subgraph_search_iterator(graphs.PathGraph(3), return_graphs=False))
1716
- sage: H = IncidenceStructure(B)
1717
- sage: H.is_generalized_quadrangle(verbose=True)
1718
+ sage: B = list(G.subgraph_search_iterator(graphs.PathGraph(3), # optional - sage.modules
1719
+ ....: return_graphs=False))
1720
+ sage: H = IncidenceStructure(B) # optional - sage.modules
1721
+ sage: H.is_generalized_quadrangle(verbose=True) # optional - sage.modules
1718
1722
Two blocks intersect on >1 points.
1719
1723
False
1720
1724
@@ -1770,25 +1774,23 @@ def dual(self, algorithm=None):
1770
1774
The dual of a projective plane is a projective plane::
1771
1775
1772
1776
sage: PP = designs.DesarguesianProjectivePlaneDesign(4)
1773
- sage: PP.dual().is_t_design(return_parameters=True)
1777
+ sage: PP.dual().is_t_design(return_parameters=True) # optional - sage.modules
1774
1778
(True, (2, 21, 5, 1))
1775
1779
1776
1780
TESTS::
1777
1781
1778
- sage: D = IncidenceStructure(4, [[0,2],[1,2,3],[2,3]])
1779
- sage: D
1782
+ sage: D = IncidenceStructure(4, [[0,2],[1,2,3],[2,3]]); D
1780
1783
Incidence structure with 4 points and 3 blocks
1781
- sage: D.dual()
1784
+ sage: D.dual() # optional - sage.modules
1782
1785
Incidence structure with 3 points and 4 blocks
1783
- sage: print(D.dual(algorithm="gap")) # optional - gap_packages
1786
+ sage: print(D.dual(algorithm="gap")) # optional - gap_packages
1784
1787
Incidence structure with 3 points and 4 blocks
1785
1788
sage: blocks = [[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]]
1786
- sage: BD = IncidenceStructure(7, blocks, name="FanoPlane")
1787
- sage: BD
1789
+ sage: BD = IncidenceStructure(7, blocks, name="FanoPlane"); BD
1788
1790
Incidence structure with 7 points and 7 blocks
1789
- sage: print(BD.dual(algorithm="gap")) # optional - gap_packages
1791
+ sage: print(BD.dual(algorithm="gap")) # optional - gap_packages
1790
1792
Incidence structure with 7 points and 7 blocks
1791
- sage: BD.dual()
1793
+ sage: BD.dual() # optional - sage.modules
1792
1794
Incidence structure with 7 points and 7 blocks
1793
1795
1794
1796
REFERENCE:
@@ -1817,28 +1819,28 @@ def automorphism_group(self):
1817
1819
1818
1820
sage: P = designs.DesarguesianProjectivePlaneDesign(2); P
1819
1821
(7,3,1)-Balanced Incomplete Block Design
1820
- sage: G = P.automorphism_group()
1821
- sage: G.is_isomorphic(PGL(3,2))
1822
+ sage: G = P.automorphism_group() # optional - sage.groups
1823
+ sage: G.is_isomorphic(PGL(3,2)) # optional - sage.groups
1822
1824
True
1823
- sage: G
1825
+ sage: G # optional - sage.groups
1824
1826
Permutation Group with generators [...]
1825
- sage: G.cardinality()
1827
+ sage: G.cardinality() # optional - sage.groups
1826
1828
168
1827
1829
1828
1830
A non self-dual example::
1829
1831
1830
1832
sage: IS = IncidenceStructure(list(range(4)), [[0,1,2,3],[1,2,3]])
1831
- sage: IS.automorphism_group().cardinality()
1833
+ sage: IS.automorphism_group().cardinality() # optional - sage.groups
1832
1834
6
1833
- sage: IS.dual().automorphism_group().cardinality()
1835
+ sage: IS.dual().automorphism_group().cardinality() # optional - sage.groups sage.modules
1834
1836
1
1835
1837
1836
1838
Examples with non-integer points::
1837
1839
1838
1840
sage: I = IncidenceStructure('abc', ('ab','ac','bc'))
1839
- sage: I.automorphism_group()
1841
+ sage: I.automorphism_group() # optional - sage.groups
1840
1842
Permutation Group with generators [('b','c'), ('a','b')]
1841
- sage: IncidenceStructure([[(1,2),(3,4)]]).automorphism_group()
1843
+ sage: IncidenceStructure([[(1,2),(3,4)]]).automorphism_group() # optional - sage.groups
1842
1844
Permutation Group with generators [((1,2),(3,4))]
1843
1845
"""
1844
1846
from sage .graphs .graph import Graph
@@ -1907,20 +1909,20 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True,
1907
1909
sage: TD.is_resolvable()
1908
1910
True
1909
1911
1910
- sage: AG = designs.AffineGeometryDesign(3,1,GF(2))
1911
- sage: AG.is_resolvable()
1912
+ sage: AG = designs.AffineGeometryDesign(3,1,GF(2)) # optional - sage.rings.finite_rings
1913
+ sage: AG.is_resolvable() # optional - sage.rings.finite_rings
1912
1914
True
1913
1915
1914
1916
Their classes::
1915
1917
1916
- sage: b,cls = TD.is_resolvable(True)
1918
+ sage: b, cls = TD.is_resolvable(True)
1917
1919
sage: b
1918
1920
True
1919
1921
sage: cls # random
1920
1922
[[[0, 3], [1, 2]], [[1, 3], [0, 2]]]
1921
1923
1922
- sage: b,cls = AG.is_resolvable(True)
1923
- sage: b
1924
+ sage: b, cls = AG.is_resolvable(True) # optional - sage.rings.finite_rings
1925
+ sage: b # optional - sage.rings.finite_rings
1924
1926
True
1925
1927
sage: cls # random
1926
1928
[[[6, 7], [4, 5], [0, 1], [2, 3]],
@@ -1941,9 +1943,9 @@ def is_resolvable(self, certificate=False, solver=None, verbose=0, check=True,
1941
1943
1942
1944
TESTS::
1943
1945
1944
- sage: _,cls1 = AG.is_resolvable(certificate=True)
1945
- sage: _,cls2 = AG.is_resolvable(certificate=True)
1946
- sage: cls1 is cls2
1946
+ sage: _, cls1 = AG.is_resolvable(certificate=True) # optional - sage.rings.finite_rings
1947
+ sage: _, cls2 = AG.is_resolvable(certificate=True) # optional - sage.rings.finite_rings
1948
+ sage: cls1 is cls2 # optional - sage.rings.finite_rings
1947
1949
False
1948
1950
"""
1949
1951
if self ._classes is None :
@@ -2152,8 +2154,8 @@ def _spring_layout(self):
2152
2154
2153
2155
sage: H = Hypergraph([{1,2,3},{2,3,4},{3,4,5},{4,5,6}]); H
2154
2156
Incidence structure with 6 points and 4 blocks
2155
- sage: L = H._spring_layout()
2156
- sage: L # random
2157
+ sage: L = H._spring_layout() # optional - sage.plot
2158
+ sage: L # random # optional - sage.plot
2157
2159
{1: (0.238, -0.926),
2158
2160
2: (0.672, -0.518),
2159
2161
3: (0.449, -0.225),
@@ -2164,9 +2166,9 @@ def _spring_layout(self):
2164
2166
{2, 3, 4}: (0.727, -0.173),
2165
2167
{4, 5, 6}: (0.838, 0.617),
2166
2168
{1, 2, 3}: (0.393, -0.617)}
2167
- sage: all(v in L for v in H.ground_set())
2169
+ sage: all(v in L for v in H.ground_set()) # optional - sage.plot
2168
2170
True
2169
- sage: all(v in L for v in map(Set,H.blocks()))
2171
+ sage: all(v in L for v in map(Set, H.blocks())) # optional - sage.plot
2170
2172
True
2171
2173
"""
2172
2174
from sage .graphs .graph import Graph
@@ -2196,9 +2198,10 @@ def _latex_(self):
2196
2198
2197
2199
sage: g = graphs.Grid2dGraph(5,5)
2198
2200
sage: C4 = graphs.CycleGraph(4)
2199
- sage: sets = Set(map(Set,list(g.subgraph_search_iterator(C4, return_graphs=False))))
2200
- sage: H = Hypergraph(sets)
2201
- sage: view(H) # not tested
2201
+ sage: sets = Set(map(Set, g.subgraph_search_iterator(C4, # optional - sage.modules
2202
+ ....: return_graphs=False)))
2203
+ sage: H = Hypergraph(sets) # optional - sage.modules
2204
+ sage: view(H) # not tested # optional - sage.modules sage.plot
2202
2205
2203
2206
TESTS::
2204
2207
0 commit comments