@@ -6212,33 +6212,45 @@ cdef class Matroid(SageObject):
6212
6212
False
6213
6213
"""
6214
6214
if self .rank() >= 2 :
6215
- for X in combinations(self .groundset(), self .rank() - 1 ):
6216
- if not self ._is_independent(frozenset (X)):
6217
- return False
6215
+ for _ in self .dependent_sets_iterator(self .rank() - 1 ):
6216
+ return False
6218
6217
return True
6219
6218
6220
6219
cpdef bint is_sparse_paving(self ) noexcept:
6221
6220
"""
6222
6221
Return if ``self`` is sparse-paving.
6223
6222
6224
- A matroid is sparse-paving if the symmetric difference of every pair
6225
- of circuits is greater than 2.
6223
+ A matroid is sparse-paving if it is paving and its dual is paving.
6226
6224
6227
6225
OUTPUT: boolean
6228
6226
6227
+ ALGORITHM:
6228
+
6229
+ First, check that the matroid is paving. Then, verify that the
6230
+ symmetric difference of every pair of distinct `r`-circuits is greater
6231
+ than 2.
6232
+
6229
6233
EXAMPLES::
6230
6234
6231
6235
sage: M = matroids.catalog.Vamos()
6232
6236
sage: M.is_sparse_paving()
6237
+ True
6238
+ sage: M = matroids.catalog.N1()
6239
+ sage: M.is_sparse_paving()
6233
6240
False
6234
- sage: M = matroids.catalog.Fano()
6241
+
6242
+ TESTS::
6243
+
6244
+ sage: M = matroids.Uniform(4, 50) # fast because we don't check M.dual().is_paving()
6235
6245
sage: M.is_sparse_paving()
6236
6246
True
6247
+ sage: for M in matroids.AllMatroids(8):
6248
+ ....: assert M.is_sparse_paving() == (M.is_paving() and M.dual().is_paving())
6237
6249
"""
6238
6250
if not self .is_paving():
6239
6251
return False
6240
6252
from itertools import combinations
6241
- for (C1, C2) in combinations(self .circuits_iterator (), 2 ):
6253
+ for (C1, C2) in combinations(self .nonbases_iterator (), 2 ):
6242
6254
if len (C1 ^ C2) <= 2 :
6243
6255
return False
6244
6256
return True
0 commit comments