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
Last revisionBoth sides next revision
tutorial:apps_matroid [2014/11/05 13:52] – [Constructing a Simple Matroid and Playing Around] schroeteruser_guide:tutorials:apps_matroid [2019/01/25 09:38] – ↷ Page moved from user_guide:apps_matroid to user_guide:tutorials:apps_matroid oroehrig
Line 1: Line 1:
-====== Short Introduction to New Application ''matroid'' ======+====== Short Introduction to application ''matroid'' ======
  
-The application ''matroid'' introduced with version 2.9.7 is in its infancy.  This tutorial is meant to show the main features available.+**This tutorial is also available as a {{ user_guide:apps_matroid.ipynb |jupyter notebook}} for polymake 3.1.**
  
-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";''+This tutorial is meant to show the main features for handling matroids available. To make ''matroid'' your current application start ''polymake'' with the option ''-A matroid'' or use the context switch 
 +<code> 
 +application "matroid"; 
 +</code> 
 +from within the ''polymake'' shell.  A permanent setting can be stored with ''%%set_custom $default_application="matroid";%%''
  
 ===== Constructing a Simple Matroid and Playing Around ===== ===== Constructing a Simple Matroid and Playing Around =====
Line 10: Line 14:
  
 <code> <code>
-matroid > $M=new Matroid(POINTS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);+matroid > $M=new Matroid(VECTORS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);
 </code> </code>
  
Line 16: Line 20:
  
 <code> <code>
-polytope > $M=new matroid::Matroid(POINTS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);+polytope > $M=new matroid::Matroid(VECTORS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]);
 </code> </code>
  
Line 24: Line 28:
 3 4 3 3 4 3
 </code> </code>
- +{{ user_guide:matroid_lattice_of_flats_example.png?nolink&200|}} 
-The ''POINTS'' are numbered consecutively, starting from zero.  The bases are encoded as sets of these ordinal numbers.+The ''VECTORS'' are numbered consecutively, starting from zero.  The bases are encoded as sets of these ordinal numbers.
  
 <code> <code>
Line 49: Line 53:
 You can also compute other properties, like  You can also compute other properties, like 
 <code> <code>
-matroid > print $M->PAVING, " ", $M->BINARY, " ", new Int( $M->SERIES_PARALLEL ), " ", new Int( $M->CONNECTED );+matroid > print $M->PAVING?"1":"0", " ", 
 +matroid (2)> $M->BINARY?"1":"0", " ", 
 +matroid (3)> $M->SERIES_PARALLEL?"1":"0", " ", 
 +matroid (4)> $M->CONNECTED?"1":"0";
 1 1 0 0 1 1 0 0
  
Line 62: Line 69:
 Even the lattice of flats could be computed and visualised. Even the lattice of flats could be computed and visualised.
 <code> <code>
-matroid > $lattice=$M->LATTICE_OF_FLATS; foreach (@{$lattice->nodes_of_dim(2)}){print $lattice->FACES->[$_]," "};+matroid > $lattice=$M->LATTICE_OF_FLATS; 
 +matroid > foreach (@{$lattice->nodes_of_rank(2)}){print $lattice->FACES->[$_]," "};
 {0 2} {0 1 3} {1 2} {2 3} {0 2} {0 1 3} {1 2} {2 3}
    
Line 73: Line 81:
 matroid > $M->LATTICE_OF_FLATS->VISUAL; matroid > $M->LATTICE_OF_FLATS->VISUAL;
 </code> </code>
-{{ :tutorial:matroid_lattice_of_flats_example.png?nolink&200 |}} 
 ===== Matroid Polytopes ===== ===== 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 subobject ''POLYTOPE'' of type ''polytope::Polytope<Rational>''.+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 subobject ''POLYTOPE'' of type ''polytope::Polytope<Rational>''.
  
 <code> <code>
Line 93: Line 100:
  
 <code> <code>
-matroid > $C=new Matroid(POINTS=>polytope::cube(3)->VERTICES);+matroid > $C=new Matroid(VECTORS=>polytope::cube(3)->VERTICES);
  
 matroid > print $C->N_BASES; matroid > print $C->N_BASES;
Line 108: Line 115:
 </code> </code>
  
-Of course you can also construct your matroid from scratch by specifying, e.g., its set of bases or non-bases and then compute other properties. The following constructs the Fano matroid, which is the simplest matroid that cannot be constructed from a vector configuration (over a field with characteristic not equal to two).+It is also possible to derive a new matroid from others.  
 +<code> 
 +matroid > # The arguments are two matroids and for each matroid a basepoint. The basepoints will be identified.  
 +matroid > $se=series_extension(uniform_matroid(2,3),0,uniform_matroid(1,3),0); 
 + 
 +matroid > print deletion($se,4)->VECTORS; 
 +1 0 0 
 +0 1 0 
 +0 0 1 
 +1 1 1 
 + 
 +matroid > $pe=parallel_extension(uniform_matroid(1,3),0,uniform_matroid(2,3),0); 
 + 
 +matroid > print dual(contraction($pe,4))->VECTORS; 
 +1 0 0 
 +0 1 0 
 +0 0 1 
 +1 1 1 
 + 
 +matroid > print projective_plane(3)->N_BASES; 
 +234 
 + 
 +matroid > print fano_matroid()->N_BASES; 
 +28 
 + 
 +matroid > print direct_sum(projective_plane(3),fano_matroid())->N_BASES," = 234*28"; 
 +6552 = 234*28 
 + 
 +matroid > print two_sum(uniform_matroid(2,4),0,uniform_matroid(2,4),0)->CIRCUITS; 
 +{0 1 2} 
 +{3 4 5} 
 +{0 1 3 4} 
 +{0 1 3 5} 
 +{0 1 4 5} 
 +{0 2 3 4} 
 +{0 2 3 5} 
 +{0 2 4 5} 
 +{1 2 3 4} 
 +{1 2 3 5} 
 +{1 2 4 5} 
 +</code> 
 + 
 +Of course you can also construct your matroid from scratch by specifying, e.g., its set of bases or non-bases and then compute other properties. The following constructs the Fano matroid, which is the simplest matroid that cannot be constructed from a vector configuration (over a field with characteristic other than two).
 <code> <code>
-matroid >  $a=new Array<Set<Int> >([0,1,5],[1,2,6],[0,2,3],[1,3,4],[2,4,5],[3,5,6],[0,4,6]);+matroid > $a=new Array<Set<Int>>([0,1,5],[1,2,6],[0,2,3],[1,3,4],[2,4,5],[3,5,6],[0,4,6]);
    
 matroid > $m=new Matroid(NON_BASES=>$a,N_ELEMENTS=>7); matroid > $m=new Matroid(NON_BASES=>$a,N_ELEMENTS=>7);
  • user_guide/tutorials/apps_matroid.txt
  • Last modified: 2019/02/04 22:55
  • by 127.0.0.1