# independentSets(Matroid,ZZ) -- independent subsets of a matroid

## Description

A subset of the ground set is called independent if it is contained in a basis, or equivalently, does not contain a circuit. This method returns certain independent subsets of the ground set, depending on the input:

If an integer $s$ is provided, then all independent subsets of size $s$ in $M$ are returned.

If a subset $S$ of the ground set of $M$ is given, then all maximal independent subsets of $S$ are returned.

If neither a size $s$ nor a subset $S$ is given, then all independent sets of M is returned (which may be quite large).

 i1 : M = matroid({a,b,c,d},{{a,b},{a,c}}) o1 = a "matroid" of rank 2 on 4 elements o1 : Matroid i2 : independentSets(M, 2) o2 = {set {0, 1}, set {0, 2}} o2 : List i3 : independentSets(M, set{1,2,3}) o3 = {set {1}, set {2}} o3 : List i4 : netList independentSets M +----------+ o4 = |set {} | +----------+ |set {0} | +----------+ |set {1} | +----------+ |set {0, 1}| +----------+ |set {2} | +----------+ |set {0, 2}| +----------+ i5 : V = specificMatroid "vamos" o5 = a "matroid" of rank 4 on 8 elements o5 : Matroid i6 : I3 = independentSets(V, 3) o6 = {set {3, 5, 6}, set {3, 5, 7}, set {3, 6, 7}, set {5, 6, 7}, set {2, 5, ------------------------------------------------------------------------ 6}, set {2, 5, 7}, set {2, 6, 7}, set {1, 5, 6}, set {1, 5, 7}, set {1, ------------------------------------------------------------------------ 6, 7}, set {0, 5, 6}, set {0, 5, 7}, set {0, 6, 7}, set {3, 4, 6}, set ------------------------------------------------------------------------ {3, 4, 7}, set {4, 6, 7}, set {2, 4, 6}, set {2, 4, 7}, set {1, 4, 6}, ------------------------------------------------------------------------ set {1, 4, 7}, set {0, 4, 6}, set {0, 4, 7}, set {1, 3, 6}, set {1, 3, ------------------------------------------------------------------------ 7}, set {0, 3, 6}, set {0, 3, 7}, set {1, 2, 6}, set {1, 2, 7}, set {0, ------------------------------------------------------------------------ 2, 6}, set {0, 2, 7}, set {3, 4, 5}, set {4, 5, 7}, set {2, 4, 5}, set ------------------------------------------------------------------------ {1, 4, 5}, set {0, 4, 5}, set {2, 3, 5}, set {2, 3, 7}, set {1, 3, 5}, ------------------------------------------------------------------------ set {0, 3, 5}, set {1, 2, 5}, set {0, 2, 5}, set {0, 1, 5}, set {0, 1, ------------------------------------------------------------------------ 7}, set {2, 3, 4}, set {1, 3, 4}, set {0, 3, 4}, set {1, 2, 4}, set {0, ------------------------------------------------------------------------ 2, 4}, set {0, 1, 4}, set {1, 2, 3}, set {0, 2, 3}, set {0, 1, 3}, set ------------------------------------------------------------------------ {0, 1, 2}, set {4, 5, 6}, set {2, 3, 6}, set {0, 1, 6}} o6 : List i7 : #I3 o7 = 56