Skip to content

Commit 39267c4

Browse files
author
Release Manager
committed
sagemathgh-39382: Correct method `is_sparse_paving` It was brought to my attention that the method `is_sparse_paving` is incorrect. See sagemath#36962 (comment). The method should only check the symmetric differences of `r`-element circuits rather than all (`r`- and `r+1`-element) circuits. The algorithm used is based on a somewhat unusual definition which can be found in https://arxiv.org/pdf/math/0404200. URL: sagemath#39382 Reported by: gmou3 Reviewer(s): Travis Scrimshaw
2 parents a7900cf + d894970 commit 39267c4

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

src/doc/en/reference/references/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,9 @@ REFERENCES:
36893689
.. [Ja1971] \N. Jacobson. *Exceptional Lie Algebras*. Marcel Dekker,
36903690
Inc. New York. 1971. IBSN No. 0-8247-1326-5.
36913691
3692+
.. [Jer2006] Mark Jerrum. *Two remarks concerning balanced matroids*.
3693+
Combinatorica 26, no. 6 (2006): 733-742.
3694+
36923695
.. [Jet2008] \D. Jetchev. Global divisibility of Heegner points and
36933696
Tamagawa numbers. Compos. Math. 144 (2008), no. 4, 811--826.
36943697
@@ -4991,6 +4994,10 @@ REFERENCES:
49914994
*Yangians and classical Lie algebras*. (1994)
49924995
:arxiv:`hep-th/9409025`
49934996
4997+
.. [MNWW2011] Dillon Mayhew, Mike Newman, Dominic Welsh, and Geoff Whittle.
4998+
*On the asymptotic proportion of connected matroids*.
4999+
European Journal of Combinatorics. 2011 Aug 1;32(6):882-90.
5000+
49945001
.. [Mol2007] Alexander Ivanovich Molev.
49955002
*Yangians and Classical Lie Algebras*.
49965003
Mathematical Surveys and Monographs.

src/sage/matroids/matroid.pyx

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6210,35 +6210,56 @@ cdef class Matroid(SageObject):
62106210
sage: M = matroids.Theta(4)
62116211
sage: M.is_paving()
62126212
False
6213+
6214+
REFERENCES:
6215+
6216+
[Oxl2011]_, p. 24.
62136217
"""
62146218
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
6219+
for _ in self.dependent_sets_iterator(self.rank() - 1):
6220+
return False
62186221
return True
62196222

62206223
cpdef bint is_sparse_paving(self) noexcept:
62216224
"""
62226225
Return if ``self`` is sparse-paving.
62236226
6224-
A matroid is sparse-paving if the symmetric difference of every pair
6225-
of circuits is greater than 2.
6227+
A matroid is sparse-paving if it is paving and its dual is paving.
62266228
62276229
OUTPUT: boolean
62286230
6231+
ALGORITHM:
6232+
6233+
First, check that the matroid is paving. Then, verify that the
6234+
symmetric difference of every pair of distinct `r`-circuits is greater
6235+
than 2.
6236+
62296237
EXAMPLES::
62306238
62316239
sage: M = matroids.catalog.Vamos()
62326240
sage: M.is_sparse_paving()
6241+
True
6242+
sage: M = matroids.catalog.N1()
6243+
sage: M.is_sparse_paving()
62336244
False
6234-
sage: M = matroids.catalog.Fano()
6245+
6246+
REFERENCES:
6247+
6248+
The definition of sparse-paving matroids can be found in [MNWW2011]_.
6249+
The algorithm uses an alternative characterization from [Jer2006]_.
6250+
6251+
TESTS::
6252+
6253+
sage: M = matroids.Uniform(4, 50) # fast because we don't check M.dual().is_paving()
62356254
sage: M.is_sparse_paving()
62366255
True
6256+
sage: for M in matroids.AllMatroids(8): # optional - matroid_database
6257+
....: assert M.is_sparse_paving() == (M.is_paving() and M.dual().is_paving())
62376258
"""
62386259
if not self.is_paving():
62396260
return False
62406261
from itertools import combinations
6241-
for (C1, C2) in combinations(self.circuits_iterator(), 2):
6262+
for (C1, C2) in combinations(self.nonbases_iterator(), 2):
62426263
if len(C1 ^ C2) <= 2:
62436264
return False
62446265
return True

0 commit comments

Comments
 (0)