Skip to content

Commit

Permalink
Merge branch '15-groundset-error' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Cali Garmo committed Nov 5, 2023
2 parents 19819ac + 6cc6669 commit d78af04
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions oriented_matroids/circuit_oriented_matroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ def __init__(self, data, groundset=None, category=None):
# If our groundset is none, make sure the groundsets are the same for
# all elements
if groundset is None and len(circuits) > 0:
groundset = circuits[0].groundset()
for X in circuits:
if X.groundset() != groundset:
raise ValueError("Groundsets must be the same")
if len(data[0]) < 3:
groundset = []
for X in circuits:
groundset = list(set(groundset+X.groundset()))
else:
groundset = circuits[0].groundset()
for X in circuits:
if X.groundset() != groundset:
raise ValueError("Groundsets must be the same")

self._circuits = circuits
self._elements = circuits
Expand Down Expand Up @@ -144,6 +149,12 @@ def is_valid(self):
Traceback (most recent call last):
...
ValueError: Every element needs an opposite
sage: C5 = [((1,),(3,),(2,)), ((1,2),(3,),(4,)), ((3,),(1,),(2,)), ((3,),(1,2),(4,))]
sage: OrientedMatroid(C5,key='circuit')
Traceback (most recent call last):
...
ValueError: Groundsets must be the same
"""
circuits = self.circuits()
Expand Down

0 comments on commit d78af04

Please sign in to comment.