#15290: BasisExchangeMatroid.groundset_list() should return a copy
------------------------------+-----------------------------
Reporter: Stefan | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: matroid theory | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
------------------------------+-----------------------------
The following will break the matroid M:
{{{
sage: M = matroids.named_matroids.Fano()
sage: len(M.dependent_r_sets(3))
7
sage: L = M.groundset_list()
sage: x = L.pop()
sage: list(M.dependent_r_sets(3))
Traceback (most recent call last)
...
IndexError: list index out of range
}}}
Solution 1: BasisExchangeMatroid.groundset_list() should return a copy of
self._E
Solution 2: BasisExchangeMatroid._E should be a tuple instead of a list.
I think Solution 2 is the preferred one, but it should be tested for
speed.
Additional suggestion: update the docstrings of groundset() and
groundset_list() in BasisExchangeMatroid so they refer to each other.
--
Ticket URL: <http://trac.sagemath.org/ticket/15290>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.