Skip to content

Commit 974cf61

Browse files
author
Release Manager
committed
gh-36962: Add is_(sparse_)paving() and automorphism_group() <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Added three functions to the main matroid class. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> These correspond to two connectivity check algorithms, `is_paving()` and `is_sparse_paving()`, and a miscellaneous function `automorphism_group()`. These are all standard and regularly used notions in matroid theory. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36962 Reported by: gmou3 Reviewer(s): Travis Scrimshaw
2 parents c7a507d + e34645b commit 974cf61

File tree

2 files changed

+91
-1
lines changed

2 files changed

+91
-1
lines changed

src/sage/matroids/matroid.pxd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ cdef class Matroid(SageObject):
175175
cpdef _is_3connected_CE(self, certificate=*) noexcept
176176
cpdef _is_3connected_BC(self, certificate=*) noexcept
177177
cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits) noexcept
178+
cpdef is_paving(self) noexcept
179+
cpdef is_sparse_paving(self) noexcept
178180

179181
# representability
180182
cpdef _local_binary_matroid(self, basis=*) noexcept
@@ -213,6 +215,7 @@ cdef class Matroid(SageObject):
213215
cpdef flat_cover(self, solver=*, verbose=*, integrality_tolerance=*) noexcept
214216

215217
# misc
218+
cpdef automorphism_group(self) noexcept
216219
cpdef bergman_complex(self) noexcept
217220
cpdef augmented_bergman_complex(self) noexcept
218221

src/sage/matroids/matroid.pyx

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ additional functionality (e.g. linear extensions).
109109
- :meth:`is_4connected() <sage.matroids.matroid.Matroid.is_4connected>`
110110
- :meth:`is_kconnected() <sage.matroids.matroid.Matroid.is_kconnected>`
111111
- :meth:`connectivity() <sage.matroids.matroid.Matroid.connectivity>`
112+
- :meth:`is_paving() <sage.matroids.matroid.Matroid.is_paving>`
113+
- :meth:`is_sparse_paving() <sage.matroids.matroid.Matroid.is_sparse_paving>`
112114
113115
- Representation
114116
- :meth:`binary_matroid() <sage.matroids.matroid.Matroid.binary_matroid>`
@@ -133,9 +135,10 @@ additional functionality (e.g. linear extensions).
133135
134136
- Construction
135137
- :meth:`union() <sage.matroids.matroid.Matroid.union>`
136-
- :math:`direct_sum() <sage.matroids.matroid.Matroid.direct_sum>`
138+
- :meth:`direct_sum() <sage.matroids.matroid.Matroid.direct_sum>`
137139
138140
- Misc
141+
- :meth:`automorphism_group() <sage.matroids.matroid.Matroid.automorphism_group>`
139142
- :meth:`broken_circuit_complex() <sage.matroids.matroid.Matroid.broken_circuit_complex>`
140143
- :meth:`chow_ring() <sage.matroids.matroid.Matroid.chow_ring>`
141144
- :meth:`matroid_polytope() <sage.matroids.matroid.Matroid.matroid_polytope>`
@@ -5953,6 +5956,55 @@ cdef class Matroid(SageObject):
59535956
return False
59545957
return True
59555958

5959+
cpdef is_paving(self) noexcept:
5960+
"""
5961+
Return if ``self`` is paving.
5962+
5963+
A matroid is paving if each of its circuits has size `r` or `r+1`.
5964+
5965+
OUTPUT:
5966+
5967+
boolean
5968+
5969+
EXAMPLES::
5970+
5971+
sage: M = matroids.named_matroids.Vamos()
5972+
sage: M.is_paving()
5973+
True
5974+
"""
5975+
for C in self.circuits():
5976+
if len(C) < self.rank():
5977+
return False
5978+
return True
5979+
5980+
cpdef is_sparse_paving(self) noexcept:
5981+
"""
5982+
Return if ``self`` is sparse-paving.
5983+
5984+
A matroid is sparse-paving if the symmetric difference of every pair
5985+
of circuits is greater than 2.
5986+
5987+
OUTPUT:
5988+
5989+
boolean
5990+
5991+
EXAMPLES::
5992+
5993+
sage: M = matroids.named_matroids.Vamos()
5994+
sage: M.is_sparse_paving()
5995+
False
5996+
sage: M = matroids.named_matroids.Fano()
5997+
sage: M.is_sparse_paving()
5998+
True
5999+
"""
6000+
if not self.is_paving():
6001+
return False
6002+
from itertools import combinations
6003+
for (C1, C2) in combinations(self.circuits(), 2):
6004+
if len(C1 ^ C2) <= 2:
6005+
return False
6006+
return True
6007+
59566008
# representability
59576009

59586010
cpdef _local_binary_matroid(self, basis=None) noexcept:
@@ -7916,6 +7968,41 @@ cdef class Matroid(SageObject):
79167968
from sage.topology.simplicial_complex import SimplicialComplex
79177969
return SimplicialComplex(self.no_broken_circuits_sets(ordering))
79187970

7971+
cpdef automorphism_group(self) noexcept:
7972+
r"""
7973+
Return the automorphism group of ``self``.
7974+
7975+
For a matroid `M`, an automorphism is a permutation `\sigma` of `E(M)`
7976+
(the groundset) such that `r(X) = r(\sigma(X))` for all `X \subseteq
7977+
E(M)`. The set of automorphisms of `M` forms a group under composition.
7978+
This automorphism group is transitive if, for every two elements `x`
7979+
and `y` of `M`, there is an automorphism that maps `x` to `y`.
7980+
7981+
EXAMPLES::
7982+
7983+
sage: M = matroids.named_matroids.Fano()
7984+
sage: G = M.automorphism_group()
7985+
sage: G.is_transitive()
7986+
True
7987+
sage: G.structure_description()
7988+
'PSL(3,2)'
7989+
sage: M = matroids.named_matroids.P8pp()
7990+
sage: M.automorphism_group().is_transitive()
7991+
True
7992+
sage: M = matroids.named_matroids.ExtendedTernaryGolayCode()
7993+
sage: G = M.automorphism_group()
7994+
sage: G.is_transitive()
7995+
True
7996+
sage: G.structure_description()
7997+
'M12'
7998+
7999+
REFERENCES:
8000+
8001+
[Oxl2011]_, p. 189.
8002+
"""
8003+
from sage.topology.simplicial_complex import SimplicialComplex
8004+
return SimplicialComplex(self.bases()).automorphism_group()
8005+
79198006
cpdef bergman_complex(self) noexcept:
79208007
r"""
79218008
Return the Bergman complex of ``self``.

0 commit comments

Comments
 (0)