Union of matroids¶
- class sage.matroids.union_matroid.MatroidSum[source]¶
Bases:
MatroidMatroid Sum.
The matroid sum of a list of matroids
is a matroid where and .INPUT:
matroids– iterator of matroids
OUTPUT:
A
MatroidSuminstance, it’s a matroid sum of all matroids inmatroids.- groundset()[source]¶
Return the groundset of the matroid.
The groundset is the set of elements that comprise the matroid.
OUTPUT: set
EXAMPLES:
sage: from sage.matroids.union_matroid import * sage: M = MatroidSum([matroids.Uniform(2,4),matroids.Uniform(2,4)]) sage: sorted(M.groundset()) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3)]
- class sage.matroids.union_matroid.MatroidUnion[source]¶
Bases:
MatroidMatroid Union.
The matroid union of a set of matroids
is a matroid where and .EXAMPLES:
sage: M1 = matroids.Uniform(3,3) sage: M2 = Matroid(bases = [frozenset({3}), frozenset({4})]) sage: M = M1.union(M2); M Matroid of rank 4 on 5 elements as matroid union of Matroid of rank 3 on 3 elements with circuit-closures {} Matroid of rank 1 on 2 elements with 2 bases sage: M.bases() SetSystem of 2 sets over 5 elements sage: list(M.circuits()) [frozenset({3, 4})]
INPUT:
matroids– iterator
OUTPUT: a
MatroidUnioninstance; a matroid union of all matroids inmatroids- groundset()[source]¶
Return the groundset of the matroid.
The groundset is the set of elements that comprise the matroid.
OUTPUT: set
EXAMPLES:
sage: from sage.matroids.union_matroid import * sage: M = MatroidUnion([matroids.Uniform(2,4),matroids.Uniform(5,8)]) sage: sorted(M.groundset()) [0, 1, 2, 3, 4, 5, 6, 7]