Dual matroids#

Theory#

Let \(M\) be a matroid with ground set \(E\). If \(B\) is the set of bases of \(M\), then the set \(\{E - b : b \in B\}\) is the set of bases of another matroid, the dual of \(M\).

EXAMPLES:

sage: M = matroids.catalog.Fano()
sage: N = M.dual()
sage: M.is_basis('abc')
True
sage: N.is_basis('defg')
True
sage: M.dual().dual() == M
True

Implementation#

The class DualMatroid wraps around a matroid instance to represent its dual. Only useful for classes that don’t have an explicit construction of the dual (such as RankMatroid and CircuitClosuresMatroid). It is also used as default implementation of the method M.dual(). For direct access to the DualMatroid constructor, run:

sage: from sage.matroids.advanced import *

See also sage.matroids.advanced.

AUTHORS:

  • Rudi Pendavingh, Michael Welsh, Stefan van Zwam (2013-04-01): initial version

Methods#

class sage.matroids.dual_matroid.DualMatroid(matroid)#

Bases: Matroid

Dual of a matroid.

For some matroid representations it can be computationally expensive to derive an explicit representation of the dual. This class wraps around any matroid to provide an abstract dual. It also serves as default implementation.

INPUT:

  • matroid - a matroid.

EXAMPLES:

sage: from sage.matroids.advanced import *
sage: M = matroids.catalog.Vamos()
sage: Md = DualMatroid(M)  # indirect doctest
sage: Md.rank('abd') == M.corank('abd')
True
sage: Md
Dual of 'Vamos: Matroid of rank 4 on 8 elements with circuit-closures
{3: {{'a', 'b', 'c', 'd'}, {'a', 'b', 'e', 'f'}, {'a', 'b', 'g', 'h'},
     {'c', 'd', 'e', 'f'}, {'e', 'f', 'g', 'h'}},
 4: {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}}}'
dual()#

Return the dual of the matroid.

Let \(M\) be a matroid with ground set \(E\). If \(B\) is the set of bases of \(M\), then the set \(\{E - b : b \in B\}\) is the set of bases of another matroid, the dual of \(M\). Note that the dual of the dual of \(M\) equals \(M\), so if this is the DualMatroid instance wrapping \(M\) then the returned matroid is \(M\).

OUTPUT:

The dual matroid.

EXAMPLES:

sage: M = matroids.catalog.Pappus().dual()
sage: N = M.dual()
sage: N.rank()
3
sage: N
Pappus: Matroid of rank 3 on 9 elements with 9 nonspanning circuits
groundset()#

Return the groundset of the matroid.

The groundset is the set of elements that comprise the matroid.

OUTPUT:

A set.

EXAMPLES:

sage: M = matroids.catalog.Pappus().dual()
sage: sorted(M.groundset())
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']