Skip to content

Commit

Permalink
NBC_sets: Return :class:SetSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
gmou3 committed May 1, 2024
1 parent 5d0bb4e commit c3bdff4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions src/sage/matroids/circuits_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ cdef class CircuitsMatroid(Matroid):
- ``ordering`` -- list (optional); a total ordering of the groundset
OUTPUT: list of frozensets
OUTPUT: :class:`SetSystem`
EXAMPLES::
Expand Down Expand Up @@ -774,7 +774,7 @@ cdef class CircuitsMatroid(Matroid):
else:
B.add(S)

return list(B)
return SetSystem(list(self.groundset()), B)

cpdef no_broken_circuits_sets(self, ordering=None, reduced=False):
r"""
Expand All @@ -787,7 +787,7 @@ cdef class CircuitsMatroid(Matroid):
- ``ordering`` -- list (optional); a total ordering of the groundset
OUTPUT: list of frozensets
OUTPUT: :class:`SetSystem`
EXAMPLES::
Expand Down Expand Up @@ -817,10 +817,11 @@ cdef class CircuitsMatroid(Matroid):
True
"""
from sage.topology.simplicial_complex import SimplicialComplex
return [frozenset(f) for f in SimplicialComplex(
self.no_broken_circuits_facets(ordering, reduced),
maximality_check=False
).face_iterator()]
cdef set NBC = set()
for f in SimplicialComplex(self.no_broken_circuits_facets(ordering, reduced),
maximality_check=False).face_iterator():
NBC.add(frozenset(f))
return SetSystem(list(self.groundset()), NBC)

cpdef broken_circuit_complex(self, ordering=None, reduced=False):
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/flats_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ cdef class FlatsMatroid(Matroid):
`(W_0, ..., W_r)`, where `W_i` is the number of flats of rank `i`, and
`r` is the rank of the matroid.
OUTPUT: a list of integers
OUTPUT: list of integers
EXAMPLES::
Expand Down
12 changes: 6 additions & 6 deletions src/sage/matroids/matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3104,7 +3104,7 @@ cdef class Matroid(SageObject):
number of independent sets of rank `i`, and `r` is the rank of the
matroid.
OUTPUT: a list of integers
OUTPUT: list of integers
EXAMPLES::
Expand Down Expand Up @@ -3136,7 +3136,7 @@ cdef class Matroid(SageObject):
matroid's characteristic polynomial. Moreover, `|w_i|` is the number of
`(i-1)`-dimensional faces of the broken circuit complex of the matroid.
OUTPUT: a list of integers
OUTPUT: list of integers
EXAMPLES::
Expand All @@ -3163,7 +3163,7 @@ cdef class Matroid(SageObject):
`(W_0, \ldots, W_r)`, where `W_i` is the number of flats of rank `i`,
and `r` is the rank of the matroid.
OUTPUT: a list of integers
OUTPUT: list of integers
EXAMPLES::
Expand Down Expand Up @@ -3232,7 +3232,7 @@ cdef class Matroid(SageObject):
- ``ordering`` -- list (optional); a total ordering of the groundset
OUTPUT: list of frozensets
OUTPUT: :class:`SetSystem`
EXAMPLES::
Expand Down Expand Up @@ -3307,7 +3307,7 @@ cdef class Matroid(SageObject):
if is_indep:
B.append(frozenset(H))
next_level.extend(Ht)
return B
return SetSystem(list(self.groundset()), B)

def no_broken_circuits_sets_iterator(self, ordering=None):
r"""
Expand Down Expand Up @@ -7733,7 +7733,7 @@ cdef class Matroid(SageObject):
exist = False
if ((u in Y) and
(v in E-Y) and
(not self.is_independent(Y|set([v]))) and
(self.is_dependent(Y|set([v]))) and
(self.is_independent((Y|set([v])) - set([u])))):
exist = True
if ((u in E-Y) and
Expand Down

0 comments on commit c3bdff4

Please sign in to comment.