Iterators for linear subclasses
The classes below are iterators returned by the functions M.linear_subclasses() and M.extensions(). See the documentation of these methods for more detail. For direct access to these classes, run:
sage: from sage.matroids.advanced import *
See also sage.matroids.advanced.
AUTHORS:
Bases: object
An internal class used for creating linear subclasses of a matroids in a depth-first manner.
A linear subclass is a set of hyperplanes with the property that
certain sets of hyperplanes must either be fully contained in
or
intersect
in at most 1 element. The way we generate them is by a
depth-first seach. This class represents a node in the search tree.
It contains the set of hyperplanes selected so far, as well as a collection of hyperplanes whose insertion has been explored elsewhere in the seach tree.
The class has methods for selecting a hyperplane to insert, for inserting hyperplanes and closing the set to become a linear subclass again, and for adding a hyperplane to the set of forbidden hyperplanes, and similarly closing that set.
Bases: object
An iterable set of linear subclasses of a matroid.
Enumerate linear subclasses of a given matroid. A linear subclass is a
collection of hyperplanes (flats of rank where
is the rank of
the matroid) with the property that no modular triple of hyperplanes has
exactly two members in the linear subclass. A triple of hyperplanes in a
matroid of rank
is modular if its intersection has rank
.
INPUT:
OUTPUT:
An enumerator for the linear subclasses of M.
If line_length is not None, the enumeration is restricted to
linear subclasses mc so containing at least one of each set of
line_length hyperplanes which have a common intersection of
rank .
If subsets is not None, the enumeration is restricted to linear subclasses mc containing all hyperplanes which fully contain some set from subsets.
If splice is not None, then the enumeration is restricted to
linear subclasses such that if
is the extension of
by
that arises from
, then
.
EXAMPLES:
sage: from sage.matroids.extension import LinearSubclasses
sage: M = matroids.Uniform(3, 6)
sage: len([mc for mc in LinearSubclasses(M)])
83
sage: len([mc for mc in LinearSubclasses(M, line_length=5)])
22
sage: for mc in LinearSubclasses(M, subsets=[[0, 1], [2, 3], [4, 5]]):
....: print len(mc)
....:
3
15
Note that this class is intended for runtime, internal use, so no loads/dumps mechanism was implemented.
Bases: object
An iterator for a set of linear subclass.
x.next() -> the next value, or raise StopIteration
Bases: sage.matroids.extension.LinearSubclasses
An iterable set of single-element extensions of a given matroid.
INPUT:
OUTPUT:
An enumerator for the extensions of M to a matroid N so that
. If line_length is not None, the enumeration
is restricted to extensions
without
-minors, where
k > line_length.
If subsets is not None, the enumeration is restricted to
extensions of
by element
so that all hyperplanes of
which fully contain some set from subsets, will also span
.
If splice is not None, then the enumeration is restricted to
extensions such that
, where
.
EXAMPLES:
sage: from sage.matroids.advanced import *
sage: M = matroids.Uniform(3, 6)
sage: len([N for N in MatroidExtensions(M, 'x')])
83
sage: len([N for N in MatroidExtensions(M, 'x', line_length=5)])
22
sage: for N in MatroidExtensions(M, 'x', subsets=[[0, 1], [2, 3],
....: [4, 5]]): print N
Matroid of rank 3 on 7 elements with 32 bases
Matroid of rank 3 on 7 elements with 20 bases
sage: M = BasisMatroid(matroids.named_matroids.BetsyRoss()); M
Matroid of rank 3 on 11 elements with 140 bases
sage: e = 'k'; f = 'h'; Me = M.delete(e); Mf=M.delete(f)
sage: for N in MatroidExtensions(Mf, f, splice=Me): print N
Matroid of rank 3 on 11 elements with 141 bases
Matroid of rank 3 on 11 elements with 140 bases
sage: for N in MatroidExtensions(Me, e, splice=Mf): print N
Matroid of rank 3 on 11 elements with 141 bases
Matroid of rank 3 on 11 elements with 140 bases
Note that this class is intended for runtime, internal use, so no loads/dumps mechanism was implemented.