Macaulay2 » Documentation
Packages » Matroids :: allMatroids
next | previous | forward | backward | up | index | toc

# allMatroids -- returns all n-element matroids of rank r

- Usage:
    `allMatroids n`
    `allMatroids(n, r)`
- Inputs:
  - n, an integer, the size of the ground set
  - r, an integer, the target rank
- Outputs:
  - a list, of matroids on n elements

## Description

This method returns a list of matroids on n elements of rank r, for small n (currently, n <= 9). This list is complete for isomorphism types of rank r matroids on n elements, i.e. every matroid on n elements of rank r is isomorphic to a unique matroid in this list.

This function will silently switch inputs so that the rank r is the smaller of the two inputs (i.e. allMatroids(3,6) and allMatroids(6,3) return the same output). If no rank r is provided, then all matroids on n elements are returned.

One can perform many verifications using this method:

    i1 : L = allMatroids 5; #L

    o2 = 38

    i3 : all(L, isWellDefined)

    o3 = true

    i4 : all(subsets(L, 2), S -> quickIsomorphismTest(S#0, S#1) == "false")

    o4 = true

    i5 : tally(L/fVector/values)

    o5 = Tally{{1, 1} => 5              }
            {1, 2, 1} => 6
            {1, 3, 1} => 4
            {1, 3, 3, 1} => 4
            {1, 4, 1} => 2
            {1, 4, 4, 1} => 3
            {1, 4, 6, 1} => 2
            {1, 4, 6, 4, 1} => 2
            {1, 5, 1} => 1
            {1, 5, 5, 1} => 1
            {1, 5, 6, 1} => 1
            {1, 5, 8, 1} => 1
            {1, 5, 8, 5, 1} => 1
            {1, 5, 10, 1} => 1
            {1, 5, 10, 7, 1} => 1
            {1, 5, 10, 10, 1} => 1
            {1, 5, 10, 10, 5, 1} => 1
            {1} => 1

    o5 : Tally

    i6 : smallMatroids = flatten apply(6, i -> allMatroids i); -- all matroids on < 6 elements

    i7 : #smallMatroids

    o7 = 70

## Ways to use allMatroids:

- `allMatroids(ZZ)`
- `allMatroids(ZZ,ZZ)`

## For the programmer

The object allMatroids is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Matroids/doc-Matroids.m2:3518:0.