From 55cc69bacdc29167778884c58362dd15c7ffe3a8 Mon Sep 17 00:00:00 2001 From: Giorgos Mousa Date: Mon, 25 Dec 2023 13:51:43 +0200 Subject: [PATCH 1/2] Add is_(sparse_)paving() and automorphism_group() --- src/sage/matroids/matroid.pxd | 3 ++ src/sage/matroids/matroid.pyx | 92 ++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/src/sage/matroids/matroid.pxd b/src/sage/matroids/matroid.pxd index 6c385f10e32..4644daddf1b 100644 --- a/src/sage/matroids/matroid.pxd +++ b/src/sage/matroids/matroid.pxd @@ -175,6 +175,8 @@ cdef class Matroid(SageObject): cpdef _is_3connected_CE(self, certificate=*) noexcept cpdef _is_3connected_BC(self, certificate=*) noexcept cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits) noexcept + cpdef is_paving(self) noexcept + cpdef is_sparse_paving(self) noexcept # representability cpdef _local_binary_matroid(self, basis=*) noexcept @@ -213,6 +215,7 @@ cdef class Matroid(SageObject): cpdef flat_cover(self, solver=*, verbose=*, integrality_tolerance=*) noexcept # misc + cpdef automorphism_group(self) noexcept cpdef bergman_complex(self) noexcept cpdef augmented_bergman_complex(self) noexcept diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index ed971cb8349..f77c242b352 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -109,6 +109,8 @@ additional functionality (e.g. linear extensions). - :meth:`is_4connected() ` - :meth:`is_kconnected() ` - :meth:`connectivity() ` + - :meth:`is_paving() ` + - :meth:`is_sparse_paving() ` - Representation - :meth:`binary_matroid() ` @@ -133,9 +135,10 @@ additional functionality (e.g. linear extensions). - Construction - :meth:`union() ` - - :math:`direct_sum() ` + - :meth:`direct_sum() ` - Misc + - :meth:`automorphism_group() ` - :meth:`broken_circuit_complex() ` - :meth:`chow_ring() ` - :meth:`matroid_polytope() ` @@ -5953,6 +5956,57 @@ cdef class Matroid(SageObject): return False return True + cpdef is_paving(self) noexcept: + """ + Return if ``self`` is paving. + + A matroid is paving if each of its circuits has size `r` or `r+1`. + + OUTPUT: + + a Boolean + + EXAMPLES:: + + sage: M = matroids.named_matroids.Vamos() + sage: M.is_paving() + True + + """ + for C in self.circuits(): + if len(C) < self.rank(): + return False + return True + + cpdef is_sparse_paving(self) noexcept: + """ + Return if ``self`` is sparse-paving. + + A matroid is sparse-paving if the symmetric difference of every pair + of circuits is greater than 2. + + OUTPUT: + + a Boolean + + EXAMPLES:: + + sage: M = matroids.named_matroids.Vamos() + sage: M.is_sparse_paving() + False + sage: M = matroids.named_matroids.Fano() + sage: M.is_sparse_paving() + True + + """ + if not self.is_paving(): + return False + from itertools import combinations + for (C1, C2) in combinations(self.circuits(), 2): + if len(C1 ^ C2) <= 2: + return False + return True + # representability cpdef _local_binary_matroid(self, basis=None) noexcept: @@ -7916,6 +7970,42 @@ cdef class Matroid(SageObject): from sage.topology.simplicial_complex import SimplicialComplex return SimplicialComplex(self.no_broken_circuits_sets(ordering)) + cpdef automorphism_group(self) noexcept: + r""" + Return the automorphism group of ``self``. + + For a matroid `M`, an automorphism is a permutation `\sigma` of `E(M)` + (the groundset) such that `r(X) = r(\sigma(X))` for all `X \subseteq + E(M)`. The set of automorphisms of `M` forms a group under composition. + This automorphism group is transitive if, for every two elements `x` + and `y` of `M`, there is an automorphism that maps `x` to `y`. + + EXAMPLES:: + + sage: M = matroids.named_matroids.Fano() + sage: G = M.automorphism_group() + sage: G.is_transitive() + True + sage: G.structure_description() + 'PSL(3,2)' + sage: M = matroids.named_matroids.P8pp() + sage: M.automorphism_group().is_transitive() + True + sage: M = matroids.named_matroids.ExtendedTernaryGolayCode() + sage: G = M.automorphism_group() + sage: G.is_transitive() + True + sage: G.structure_description() + 'M12' + + REFERENCES: + + [Oxl2011], p. 189. + + """ + from sage.topology.simplicial_complex import SimplicialComplex + return SimplicialComplex(self.bases()).automorphism_group() + cpdef bergman_complex(self) noexcept: r""" Return the Bergman complex of ``self``. From e34645b98c3a8f014af9959f4ab12afbb1480170 Mon Sep 17 00:00:00 2001 From: Giorgos Mousa Date: Fri, 29 Dec 2023 03:42:54 +0200 Subject: [PATCH 2/2] Changes suggested by reviewer --- src/sage/matroids/matroid.pyx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index f77c242b352..245e4191a20 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -5964,14 +5964,13 @@ cdef class Matroid(SageObject): OUTPUT: - a Boolean + boolean EXAMPLES:: sage: M = matroids.named_matroids.Vamos() sage: M.is_paving() True - """ for C in self.circuits(): if len(C) < self.rank(): @@ -5987,7 +5986,7 @@ cdef class Matroid(SageObject): OUTPUT: - a Boolean + boolean EXAMPLES:: @@ -5997,7 +5996,6 @@ cdef class Matroid(SageObject): sage: M = matroids.named_matroids.Fano() sage: M.is_sparse_paving() True - """ if not self.is_paving(): return False @@ -8000,8 +7998,7 @@ cdef class Matroid(SageObject): REFERENCES: - [Oxl2011], p. 189. - + [Oxl2011]_, p. 189. """ from sage.topology.simplicial_complex import SimplicialComplex return SimplicialComplex(self.bases()).automorphism_group()