user_guide:tutorials:apps_matroid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:apps_matroid [2009/11/03 12:59] – Links to tutorial:graph_tutorial changed to tutorial:apps_graph sherrmannuser_guide:tutorials:apps_matroid [2019/02/04 22:55] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Short Introduction to New Application ''matroid'' ====== +{{page>.:latest:@FILEID@}}
- +
-The application ''matroid'' introduced with version 2.9.7 is in its infancy.  This tutorial is meant to show the main features available. +
- +
-To make ''matroid'' your current application start ''polymake'' with the option ''-A matroid'' or use the context switch ''application "matroid";'' from within the ''polymake'' shell.  A permanent setting can be stored with ''set_custom $default_application="matroid";'' +
- +
-===== Constructing a Simple Matroid and Playing Around ===== +
- +
-This is how to produce a matroid from a vector configuration.  The matroid is defined by the linear dependence among subsets of these vectors. +
- +
-<code> +
-matroid > $M=new Matroid(POINTS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]); +
-</code> +
- +
-If ''matroid'' is not your default application you have to qualify ''Matroid'' as in: +
- +
-<code> +
-polytope > $M=new matroid::Matroid(POINTS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]); +
-</code> +
- +
-Output of basic statistics. +
-<code> +
-matroid > print $M->N_BASES, " ", $M->N_ELEMENTS, " ", $M->RANK; +
-3 4 3 +
-</code> +
- +
-The ''POINTS'' are numbered consecutively, starting from zero.  The bases are encoded as sets of these ordinal numbers. +
- +
-<code> +
-matroid > print $M->BASES; +
-{0 1 2} +
-{0 2 3} +
-{1 2 3} +
-</code> +
- +
-Similarly you can compute the circuits and cocircuits. +
- +
-<code> +
-matroid > print $M->CIRCUITS; +
-{0 1 3} +
- +
-matroid > print $M->COCIRCUITS; +
-{2} +
-{0 1} +
-{0 3} +
-{1 3} +
-</code> +
- +
-===== Matroid Polytopes ===== +
- +
-You can construct a polytope from the bases of a matroid as the convex hull of the characteristic vectors of the bases.  This is the //matroid polytope// of that matroid, sometimes also called the //matroid bases polytope// The matroid polytope of the matroid ''$M'' is a a subobject ''POLYTOPE'' of type ''polytope::Polytope<Rational>''+
- +
-<code> +
-matroid > print $M->POLYTOPE->VERTICES; +
-1 1 1 1 0 +
-1 1 0 1 1 +
-1 0 1 1 1 +
- +
-matroid > print $M->POLYTOPE->F_VECTOR; +
-3 3 +
-</code> +
- +
-===== Other Constructions ===== +
- +
-The vertices of a polytope give rise to a matroid.  Here is an example for the vertices of the three-dimensional regular cube.  Notice that point coordinates in the application 'polytope' are given by homogeneous coordinates.  Hence this matroid is defined by the relation of affine dependence. +
- +
-<code> +
-matroid > $C=new Matroid(POINTS=>polytope::cube(3)->VERTICES); +
- +
-matroid > print $C->N_BASES; +
-58 +
-</code> +
- +
-The system also allows you to construct a matroid from a graph.  The bases correspond to the spanning trees then.  Notice that there is more than one way to encode a graph in ''polymake'' Read the [[apps_graph|tutorial on graphs]] for details. +
- +
-<code> +
-matroid > $G=matroid_from_graph(polytope::cube(3)->GRAPH); +
- +
-matroid > print $G->N_BASES; +
-792 +
-</code> +
  
  • user_guide/tutorials/apps_matroid.txt
  • Last modified: 2019/02/04 22:55
  • by 127.0.0.1