@@ -1088,25 +1088,20 @@ def P8pp():
1088
1088
1089
1089
sage: from sage.matroids.advanced import *
1090
1090
sage: M = matroids.catalog.P8pp(); M
1091
- P8'': Matroid of rank 4 on 8 elements with circuit-closures
1092
- {3: {{'a', 'b', 'f', 'h'}, {'a', 'c', 'e', 'f'}, {'a', 'c', 'g', 'h'},
1093
- {'a', 'd', 'e', 'g'}, {'b', 'c', 'e', 'g'}, {'b', 'd', 'e', 'h'},
1094
- {'b', 'd', 'f', 'g'}, {'c', 'd', 'f', 'h'}},
1095
- 4: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}}}
1091
+ P8'': Matroid of rank 4 on 8 elements with 8 nonspanning circuits
1096
1092
sage: M.is_isomorphic(M.dual()) and not M.equals(M.dual())
1097
1093
True
1098
1094
sage: len(get_nonisomorphic_matroids([M.contract(i) for i in M.groundset()]))
1099
1095
1
1100
- sage: M.is_valid() # long time
1096
+ sage: M.is_valid() and M.is_paving()
1101
1097
True
1102
1098
1103
1099
REFERENCES:
1104
1100
1105
1101
[Oxl2011]_, p. 651.
1106
1102
"""
1107
- CC = {3 : ['abfh' , 'bceg' , 'cdfh' , 'adeg' , 'acef' , 'bdfg' , 'acgh' , 'bdeh' ],
1108
- 4 : ['abcdefgh' ]}
1109
- M = CircuitClosuresMatroid (groundset = 'abcdefgh' , circuit_closures = CC )
1103
+ NSC = ['abfh' , 'bceg' , 'cdfh' , 'adeg' , 'acef' , 'bdfg' , 'acgh' , 'bdeh' ]
1104
+ M = Matroid (groundset = 'abcdefgh' , rank = 4 , nonspanning_circuits = NSC )
1110
1105
M .rename ("P8'': " + repr (M ))
1111
1106
return M
1112
1107
@@ -1336,11 +1331,7 @@ def Pappus(groundset=None):
1336
1331
1337
1332
sage: from sage.matroids.advanced import setprint
1338
1333
sage: M = matroids.catalog.Pappus(); M
1339
- Pappus: Matroid of rank 3 on 9 elements with circuit-closures
1340
- {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'},
1341
- {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'},
1342
- {'c', 'e', 'g'}, {'d', 'e', 'f'}, {'g', 'h', 'i'}},
1343
- 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}}
1334
+ Pappus: Matroid of rank 3 on 9 elements with 9 nonspanning circuits
1344
1335
sage: setprint(M.nonspanning_circuits())
1345
1336
[{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'},
1346
1337
{'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'d', 'e', 'f'},
@@ -1356,9 +1347,8 @@ def Pappus(groundset=None):
1356
1347
1357
1348
[Oxl2011]_, p. 655.
1358
1349
"""
1359
- CC = {2 : ['abc' , 'def' , 'ceg' , 'bfg' , 'cdh' , 'afh' , 'bdi' , 'aei' , 'ghi' ],
1360
- 3 : ['abcdefghi' ]}
1361
- M = CircuitClosuresMatroid (groundset = 'abcdefghi' , circuit_closures = CC )
1350
+ NSC = ['abc' , 'def' , 'ceg' , 'bfg' , 'cdh' , 'afh' , 'bdi' , 'aei' , 'ghi' ]
1351
+ M = Matroid (groundset = 'abcdefghi' , rank = 3 , nonspanning_circuits = NSC )
1362
1352
M .rename ("Pappus: " + repr (M ))
1363
1353
return M
1364
1354
@@ -1375,11 +1365,7 @@ def NonPappus():
1375
1365
1376
1366
sage: from sage.matroids.advanced import setprint
1377
1367
sage: M = matroids.catalog.NonPappus(); M
1378
- NonPappus: Matroid of rank 3 on 9 elements with circuit-closures
1379
- {2: {{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'},
1380
- {'b', 'd', 'i'}, {'b', 'f', 'g'}, {'c', 'd', 'h'},
1381
- {'c', 'e', 'g'}, {'g', 'h', 'i'}},
1382
- 3: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}}}
1368
+ NonPappus: Matroid of rank 3 on 9 elements with 8 nonspanning circuits
1383
1369
sage: setprint(M.nonspanning_circuits())
1384
1370
[{'a', 'b', 'c'}, {'a', 'e', 'i'}, {'a', 'f', 'h'}, {'b', 'd', 'i'},
1385
1371
{'b', 'f', 'g'}, {'c', 'd', 'h'}, {'c', 'e', 'g'}, {'g', 'h', 'i'}]
@@ -1394,9 +1380,8 @@ def NonPappus():
1394
1380
1395
1381
[Oxl2011]_, p. 655.
1396
1382
"""
1397
- CC = {2 : ['abc' , 'ceg' , 'bfg' , 'cdh' , 'afh' , 'bdi' , 'aei' , 'ghi' ],
1398
- 3 : ['abcdefghi' ]}
1399
- M = CircuitClosuresMatroid (groundset = 'abcdefghi' , circuit_closures = CC )
1383
+ NSC = ['abc' , 'ceg' , 'bfg' , 'cdh' , 'afh' , 'bdi' , 'aei' , 'ghi' ]
1384
+ M = Matroid (groundset = 'abcdefghi' , rank = 3 , nonspanning_circuits = NSC )
1400
1385
M .rename ("NonPappus: " + repr (M ))
1401
1386
return M
1402
1387
@@ -1447,6 +1432,7 @@ def K5dual():
1447
1432
[Oxl2011]_, p. 656.
1448
1433
"""
1449
1434
M = CompleteGraphic (5 ).dual ()
1435
+ # M = Matroid(circuits=M.circuits())
1450
1436
M .rename ("M*(K5): " + repr (M ))
1451
1437
return M
1452
1438
@@ -2284,7 +2270,7 @@ def Psi(r):
2284
2270
EXAMPLES::
2285
2271
2286
2272
sage: matroids.Psi(7)
2287
- Psi_7: Matroid of rank 7 on 14 elements with 2060 bases
2273
+ Psi_7: Matroid of rank 7 on 14 elements with 105 nonspanning circuits
2288
2274
2289
2275
The matroid `\Psi_r` is `3`-connected but, for all `r \ge 4`, not `4`-connected::
2290
2276
@@ -2346,18 +2332,7 @@ def genbin(n, bs=""):
2346
2332
j += 1
2347
2333
NSC += [C ]
2348
2334
2349
- import itertools
2350
- B = [] # bases
2351
- for b in itertools .combinations (E , r ):
2352
- flag = True
2353
- for C in NSC :
2354
- if set (b ) >= set (C ):
2355
- flag = False
2356
- break
2357
- if flag :
2358
- B += [list (b )]
2359
-
2360
- M = Matroid (groundset = E , bases = B )
2335
+ M = Matroid (groundset = E , rank = r , nonspanning_circuits = NSC )
2361
2336
M .rename ("Psi_" + str (r ) + ": " + repr (M ))
2362
2337
return M
2363
2338
@@ -4253,6 +4228,7 @@ def complement(groundset, subset):
4253
4228
6 : [gs ],
4254
4229
},
4255
4230
)
4231
+ M = Matroid (circuits = M .circuits ())
4256
4232
M .rename ("NestOfTwistedCubes: " + repr (M ))
4257
4233
return M
4258
4234
@@ -4747,16 +4723,15 @@ def R9A():
4747
4723
4748
4724
EXAMPLES::
4749
4725
4750
- sage: M = matroids.catalog.R9A()
4751
- sage: M.is_valid() # long time
4726
+ sage: M = matroids.catalog.R9A(); M
4727
+ R9A: Matroid of rank 4 on 9 elements with 13 nonspanning circuits
4728
+ sage: M.is_valid()
4752
4729
True
4753
4730
"""
4754
- E = 'abcdefghi'
4755
- CC = {3 : ['abde' , 'bcdf' , 'aceg' , 'abch' , 'aefh' , 'adgh' , 'acdi' , 'abfi' ,
4756
- 'defi' , 'begi' , 'bdhi' , 'cehi' , 'fghi' ],
4757
- 4 : [E ]}
4758
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4759
- M .rename ('R9A: ' + repr (M ))
4731
+ NSC = ['abch' , 'abde' , 'abfi' , 'acdi' , 'aceg' , 'adgh' , 'aefh' , 'bcdf' ,
4732
+ 'bdhi' , 'begi' , 'cehi' , 'defi' , 'fghi' ]
4733
+ M = Matroid (groundset = 'abcdefghi' , rank = 4 , nonspanning_circuits = NSC )
4734
+ M .rename ("R9A: " + repr (M ))
4760
4735
return M
4761
4736
4762
4737
@@ -4771,16 +4746,15 @@ def R9B():
4771
4746
4772
4747
EXAMPLES::
4773
4748
4774
- sage: M = matroids.catalog.R9B()
4775
- sage: M.is_valid() # long time
4749
+ sage: M = matroids.catalog.R9B(); M
4750
+ R9B: Matroid of rank 4 on 9 elements with 13 nonspanning circuits
4751
+ sage: M.is_valid() and M.is_paving()
4776
4752
True
4777
4753
"""
4778
- E = 'abcdefghi'
4779
- CC = {3 : ['abde' , 'bcdf' , 'aceg' , 'abch' , 'befh' , 'cdgh' , 'bcei' , 'adfi' ,
4780
- 'abgi' , 'degi' , 'bdhi' , 'aehi' , 'fghi' ],
4781
- 4 : [E ]}
4782
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4783
- M .rename ('R9B: ' + repr (M ))
4754
+ NSC = ['abde' , 'bcdf' , 'aceg' , 'abch' , 'befh' , 'cdgh' , 'bcei' , 'adfi' ,
4755
+ 'abgi' , 'degi' , 'bdhi' , 'aehi' , 'fghi' ]
4756
+ M = Matroid (groundset = 'abcdefghi' , rank = 4 , nonspanning_circuits = NSC )
4757
+ M .rename ("R9B: " + repr (M ))
4784
4758
return M
4785
4759
4786
4760
@@ -4791,22 +4765,20 @@ def Block_9_4():
4791
4765
4792
4766
EXAMPLES::
4793
4767
4794
- sage: M = matroids.catalog.Block_9_4()
4795
- sage: M.is_valid() # long time
4768
+ sage: M = matroids.catalog.Block_9_4(); M
4769
+ Block(9, 4): Matroid of rank 4 on 9 elements with 18 nonspanning
4770
+ circuits
4771
+ sage: M.is_valid() and M.is_paving()
4796
4772
True
4797
4773
sage: BD = BlockDesign(M.groundset(), M.nonspanning_circuits())
4798
4774
sage: BD.is_t_design(return_parameters=True)
4799
4775
(True, (2, 9, 4, 3))
4800
4776
"""
4801
- E = 'abcdefghi'
4802
- CC = {
4803
- 3 : ['abcd' , 'acef' , 'bdef' , 'cdeg' , 'abfg' , 'adeh' , 'bcfh' , 'acgh' ,
4804
- 'begh' , 'dfgh' , 'abei' , 'cdfi' , 'bcgi' , 'adgi' , 'efgi' , 'bdhi' ,
4805
- 'cehi' , 'afhi' ],
4806
- 4 : [E ]
4807
- }
4808
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4809
- M .rename ('Block(9, 4): ' + repr (M ))
4777
+ NSC = ['abcd' , 'acef' , 'bdef' , 'cdeg' , 'abfg' , 'adeh' , 'bcfh' , 'acgh' ,
4778
+ 'begh' , 'dfgh' , 'abei' , 'cdfi' , 'bcgi' , 'adgi' , 'efgi' , 'bdhi' ,
4779
+ 'cehi' , 'afhi' ]
4780
+ M = Matroid (groundset = 'abcdefghi' , rank = 4 , nonspanning_circuits = NSC )
4781
+ M .rename ("Block(9, 4): " + repr (M ))
4810
4782
return M
4811
4783
4812
4784
@@ -4819,22 +4791,19 @@ def TicTacToe():
4819
4791
4820
4792
EXAMPLES::
4821
4793
4822
- sage: M = matroids.catalog.TicTacToe()
4823
- sage: M.is_valid() # long time
4794
+ sage: M = matroids.catalog.TicTacToe(); M
4795
+ TicTacToe: Matroid of rank 5 on 9 elements with 8 nonspanning circuits
4796
+ sage: M.is_valid() and M.is_paving()
4824
4797
True
4825
4798
4826
4799
REFERENCES:
4827
4800
4828
4801
[Hoc]_
4829
4802
"""
4830
- E = 'abcdefghi'
4831
- CC = {
4832
- 4 : ['abcdg' , 'adefg' , 'abceh' , 'abcfi' , 'cdefi' , 'adghi' ,
4833
- 'beghi' , 'cfghi' ],
4834
- 5 : [E ]
4835
- }
4836
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4837
- M .rename ('TicTacToe: ' + repr (M ))
4803
+ NSC = ['abcdg' , 'adefg' , 'abceh' , 'abcfi' , 'cdefi' , 'adghi' , 'beghi' ,
4804
+ 'cfghi' ]
4805
+ M = Matroid (groundset = 'abcdefghi' , rank = 5 , nonspanning_circuits = NSC )
4806
+ M .rename ("TicTacToe: " + repr (M ))
4838
4807
return M
4839
4808
4840
4809
@@ -4876,25 +4845,23 @@ def Block_10_5():
4876
4845
4877
4846
EXAMPLES::
4878
4847
4879
- sage: M = matroids.catalog.Block_10_5()
4880
- sage: M.is_valid() # long time
4848
+ sage: M = matroids.catalog.Block_10_5(); M
4849
+ Block(10, 5): Matroid of rank 5 on 10 elements with 36 nonspanning
4850
+ circuits
4851
+ sage: M.is_valid() and M.is_paving()
4881
4852
True
4882
4853
sage: BD = BlockDesign(M.groundset(), M.nonspanning_circuits())
4883
4854
sage: BD.is_t_design(return_parameters=True)
4884
4855
(True, (3, 10, 5, 3))
4885
4856
"""
4886
- E = 'abcdefghij'
4887
- CC = {
4888
- 4 : ['abcde' , 'acdfg' , 'bdefg' , 'bcdfh' , 'abefh' , 'abcgh' , 'adegh' ,
4889
- 'cefgh' , 'bcefi' , 'adefi' , 'bcdgi' , 'acegi' , 'abfgi' , 'abdhi' ,
4890
- 'cdehi' , 'acfhi' , 'beghi' , 'dfghi' , 'abdfj' , 'acefj' , 'abegj' ,
4891
- 'cdegj' , 'bcfgj' , 'acdhj' , 'bcehj' , 'defhj' , 'bdghj' , 'afghj' ,
4892
- 'abcij' , 'bdeij' , 'cdfij' , 'adgij' , 'efgij' , 'aehij' , 'bfhij' ,
4893
- 'cghij' ],
4894
- 5 : [E ]
4895
- }
4896
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4897
- M .rename ('Block(10, 5): ' + repr (M ))
4857
+ NSC = ['abcde' , 'acdfg' , 'bdefg' , 'bcdfh' , 'abefh' , 'abcgh' , 'adegh' ,
4858
+ 'cefgh' , 'bcefi' , 'adefi' , 'bcdgi' , 'acegi' , 'abfgi' , 'abdhi' ,
4859
+ 'cdehi' , 'acfhi' , 'beghi' , 'dfghi' , 'abdfj' , 'acefj' , 'abegj' ,
4860
+ 'cdegj' , 'bcfgj' , 'acdhj' , 'bcehj' , 'defhj' , 'bdghj' , 'afghj' ,
4861
+ 'abcij' , 'bdeij' , 'cdfij' , 'adgij' , 'efgij' , 'aehij' , 'bfhij' ,
4862
+ 'cghij' ]
4863
+ M = Matroid (groundset = 'abcdefghij' , rank = 5 , nonspanning_circuits = NSC )
4864
+ M .rename ("Block(10, 5): " + repr (M ))
4898
4865
return M
4899
4866
4900
4867
@@ -4949,20 +4916,19 @@ def BetsyRoss():
4949
4916
4950
4917
EXAMPLES::
4951
4918
4952
- sage: M = matroids.catalog.BetsyRoss()
4919
+ sage: M = matroids.catalog.BetsyRoss(); M
4920
+ BetsyRoss: Matroid of rank 3 on 11 elements with 25 nonspanning
4921
+ circuits
4953
4922
sage: len(M.circuit_closures()[2])
4954
4923
10
4955
- sage: M.is_valid() # long time
4924
+ sage: M.is_valid()
4956
4925
True
4957
4926
"""
4958
- E = 'abcdefghijk'
4959
- CC = {
4960
- 2 : ['acfg' , 'bdgh' , 'cehi' , 'befj' , 'adij' , 'dfk' ,
4961
- 'egk' , 'ahk' , 'bik' , 'cjk' ],
4962
- 3 : [E ]
4963
- }
4964
- M = CircuitClosuresMatroid (groundset = E , circuit_closures = CC )
4965
- M .rename ('BetsyRoss: ' + repr (M ))
4927
+ NSC = ['acf' , 'acg' , 'adi' , 'adj' , 'afg' , 'ahk' , 'aij' , 'bdg' , 'bdh' ,
4928
+ 'bef' , 'bej' , 'bfj' , 'bgh' , 'bik' , 'ceh' , 'cei' , 'cfg' , 'chi' ,
4929
+ 'cjk' , 'dfk' , 'dgh' , 'dij' , 'efj' , 'egk' , 'ehi' ]
4930
+ M = Matroid (groundset = 'abcdefghijk' , rank = 3 , nonspanning_circuits = NSC )
4931
+ M .rename ("BetsyRoss: " + repr (M ))
4966
4932
return M
4967
4933
4968
4934
0 commit comments