A matroid is a mathematical structure that provides a generalization/abstraction of the notion of linear independence. Use of this module presumes familiarity with matroids.
See the documentation for information on how to use this module.
M = Matroid(A)
for a matrixA
creates the matroid based on the linear independent subsets of columns ofA
.M = Matroid(g)
for a graphg
creates the matroid based on the acyclic subsets of the edges ofg
.rank(M)
gives the rank of the matroid.rank(M, X)
gives the rank of the setX
in the matroid.ne(M)
gives the number of elements ofM
. Note that the ground set ofM
is always of the form{1,2,...,m}
.
julia> using Matroids, Graphs, ShowSet
julia> g = cycle_graph(5)
{5, 5} undirected simple Int64 graph
julia> M = Matroid(g)
{5, 4} matroid
The output {5, 4} matroid
signals that M
is a matroid with 5 elements that has rank 4.
julia> basis(M)
{2,3,4,5}
julia> dual(M)
{5, 1} matroid
Additional code for this module may be found in the extras
folder.