Documentation Strings for Types & Functions

Types

Matroids

Matroids.MatroidType

Create a Matroid as follows:

  • Matroid(m::Int, r::AbstractRankFunction) given the number of elements and a rank function.
  • Matroid(A::AbstractMatrix) given a matrix.
  • Matroid(g::Graph) given a graph.
  • Matroid(g::EasyMultiGraph) given a multigraph.
  • Matroid() yields the matroid with no elements.

See also: UniformMatroid.

source
Matroids.TransversalMatroidFunction
TransversalMatroid(m::Int, the_sets::Vector{Set{T}}) where {T<:Integer}

Create a transversal matroid with ground set S={1,2,...,m}. Every set in the list the_sets should be a subset of S.

source
Matroids.UniformMatroidFunction
UniformMatroid(m::Int, k::Int)

Create a matroid with m elements in which all sets of size k or smaller are independent.

source

Multigraphs

Matroids.EasyMultiGraphType

This is a bare-bones implementation of multigraphs. These graphs are undirected and may have loops. All edges may appear multiple times in the multigraph.

There are two constructors:

  • EasyMultiGraph(n::Int) – create a multigraph with n vertices (and no edges)
  • EasyMultiGraph(g::graph) – create a multigraph from a graph g with all edge multipliticies equal to 1.

Note that edges may be added or removed, but the number of vertices cannot be changed.

See: add! and rem!

source

Rank Functions Supertype

Matroids.AbstractRankFunctionType
AbstractRankFunction

This is the supertype for all matroid rank functions. Its subtypes are not exported, but can be viewed with subtypes(AbstractRankFunction).

source

Functions

Base.:==Method
(==)(M1::Matroid, M2::Matroid)

Test if matroids M1 and M2 are the same.

WARNING: Except for small matroids, this function is incredibly slow.

See fuzzy_equal

source
Graphs.LinAlg.contractMethod
contract(M::Matroid, X)

Form a new matroid by contracting the elements of X in the matroid M. Here, X may be a Set or a Vector of integer values, or a single integer.

source
Graphs.LinAlg.incidence_matrixMethod
incidence_matrix(g::EasyMultiGraph)

Create a signed incidence matrix for g. Multiple edges become repeated columns. Loops become all-zero columns. The order of the columns exactly matches the output of edges(g).

source
Graphs.edgesMethod
edges(g::EasyMultiGraph)

Return the edges of g as a list of ordered pairs (u,v) with u ≤ v. Edges are repeated in the list according to their multiplicity.

source
Graphs.neMethod
ne(M::Matroid)

Return the number of elements in the matroid M.

source
LinearAlgebra.rankMethod
rank(M::Matroid, X::Set{T})::Int where {T<:Integer}
rank(M::Matroid)::Int

Return the rank of the set X in the matroid M.

We support alternative ways to invoke rank: For example, rank(M,a,b,c) and rank(M,[a,b,c]) are the same as rank(M,Set([a,b,c])).

Without X, return the rank of the matroid M.

source
Matroids.TransversalMatroidMethod
TransversalMatroid(m::Int, the_sets::Vector{Set{T}}) where {T<:Integer}

Create a transversal matroid with ground set S={1,2,...,m}. Every set in the list the_sets should be a subset of S.

source
Matroids.UniformMatroidMethod
UniformMatroid(m::Int, k::Int)

Create a matroid with m elements in which all sets of size k or smaller are independent.

source
Matroids._column_pickerMethod
_column_picker(A::AbstractMatrix, X::Set{T}) where {T<:Integer}

Return the submatrix of A using the columns specified in S.

source
Matroids._random_setFunction
_random_set(n::Int, p::Real=0.5)

Create a random subset of {1,2,...,n} where each element is present in the set with probability p.

source
Matroids._random_weightsMethod
_random_weights(n)::Dict{Int,Float64}

Create a dictionary with keys 1 through n assigned iid random [0,1] values.

source
Matroids._set_checkMethod
_set_check(X::Set{T}, m::Int) where {T<:Integer}

Check S is a subset of {1,2,...,m}. If not, throw an error.

source
Matroids._sets_to_matrixMethod
_sets_to_matrix(m::Int, the_sets::Vector{Set{T}}) where {T<:Integer}

Create an m-by-length(the_sets) matrix whose i,j-entry is -1 if j ∈ the_sets[i] and 0 otherwise.

source
Matroids._sort_orderMethod
_sort_order(wt::Dict{T,R}) where {T<:Integer,R<:Real}

Return the keys of wt as a list such that their corresponding values are in nondecreasing order.

source
Matroids.add!Method
add!(g::EasyMultiGraph, u, v)
add!(g::EasyMultiGraph, (u,v))

Add an edge to the multigraph by increasing its multiplicity by 1. Return true if successful.

source
Matroids.basisMethod
basis(M::Matroid, X::Set)::Set{Int}

Return a independent subset of X that has size rank(M,X).

source
Matroids.basisMethod
basis(M::Matroid)::Set{Int}

Return a basis (maximum size independent set) of M.

source
Matroids.closureMethod
closure(M::Matroid, X::Set)

Compute the closure [a.k.a. span] of a set of elements X of a matroid.

source
Matroids.deleteMethod
delete(M::Matroid, X)

Delete the elements in X from the matroid M. Here, X may be a Set or a Vector of integer values, or a single integer.

source
Matroids.disjoint_unionMethod
disjoint_union(M1::Matroid, M2::Matroid)::Matroid

Form the disjoint union of two matroids. May be invoked as M1 + M2.

source
Matroids.find_labelMethod
find_label(M::Matroid, lab)

Find an element of M whose label is lab, or return 0 if no such label exists.

source
Matroids.fuzzy_equalFunction
fuzzy_equal(M1::Matroid, M2::Matroid, reps::Int=1000)::Bool

This is a randomized test to see if two matroids are equal. If the result is false, they are definitely not equal. If the result is true, they probably are.

source
Matroids.get_labelMethod
get_label(M::Matroid, x::T) where {T<:Integer}

Return the label associated with element x of the matroid M.

source
Matroids.iscircuitMethod
iscircuit(M::Matroid, X::Set{T})::Bool where {T<:Integer}

Check if X is a circuit in the matroid M.

source
Matroids.iscoloopMethod
iscoloop(M, x::T)::Bool where {T<:Integer}

Check if x is a co-loop in the matroid M.

source
Matroids.isflatMethod
isflat(M::Matroid, X::Set)::Bool

Return true is X is equal to its closure in the matroid M.

source
Matroids.isindependentMethod
isindependent(M::Matroid, X::Set{T})::Bool where {T<:Integer}

Check if the set X is independent in the matroid M.

source
Matroids.isloopMethod
isloop(M, x::T)::Bool where {T<:Integer}

Check if x is a loop in the matroid M.

source
Matroids.min_weight_basisMethod
min_weight_basis(M::Matroid, wt::Dict{T,R})::Set{Int} where {T<:Integer,R<:Real}

Return a minimum weight basis of M where the weights of the elements are specified by wt.

source
Matroids.random_basisMethod
random_basis(M::Matroid)::Set{Int}

Generate a random basis for M by assigning random weights to the elements of M and returning a minimum weight basis.

source
Matroids.rem!Method
rem!(g::EasyMultiGraph, u, v)
rem!(g::EasyMultiGraph, (u,v))

Remove an edge from the multigraph by decreasing its multiplicity by 1. Return true if successful.

source
Matroids.reset_labels!Method
reset_labels!(M::Matroid)

Set the labels of the elements of M to their default, i.e., element x has label x.

source
Matroids.set_label!Method
set_label!(M::Matroid, x::T, lab) where {T<:Integer}

Set the label of element x in matroid M to lab.

source