Skip to content

Conversation

@gmou3
Copy link
Contributor

@gmou3 gmou3 commented Dec 3, 2025

This was already working as intented (confusingly), probably due to some Cython optimization which avoided the min on an empty dict. I added the check for clarity and robustness.

For example, this calls min on an empty dict:

sage: from sage.matroids.circuits_matroid import CircuitsMatroid
sage: M = matroids.Uniform(5, 5)
sage: CM = CircuitsMatroid(M)
sage: CM.dependent_sets(2)
SetSystem of 0 sets over 5 elements

The addition of a print(min(self._k_C)) makes the issue clear, as it raises:

ValueError: min() iterable argument is empty

This was already working as intented (confusingly), probably due to some Cython optimization which avoided the min on an empty dict.
I added the check for clarity and robustness.

For example, this calls min on an empty dict:
```python
sage: from sage.matroids.circuits_matroid import CircuitsMatroid
sage: M = matroids.Uniform(5, 5)
sage: CM = CircuitsMatroid(M)
sage: CM.dependent_sets(2)
SetSystem of 0 sets over 5 elements
```

The addition of a `print(min(self._k_C))` makes the issue clear, as it raises:
```
ValueError: min() iterable argument is empty
```
Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants