Label the ground set of a matroid from 1 to n

Questions and problems about using polymake go here.
qichen
Posts: 8
Joined: 09 Jul 2020, 02:01

Label the ground set of a matroid from 1 to n

Postby qichen » 31 Jul 2021, 04:30

The default labels of the ground set of a matroid with cardinality n is from 0 to n-1. How to change it to from 1 to n ? Thanks.

User avatar
joswig
Main Author
Posts: 279
Joined: 24 Dec 2010, 11:10

Re: Label the ground set of a matroid from 1 to n

Postby joswig » 31 Jul 2021, 18:44

Internally, polymake will always use indices starting at zero.

Code: Select all

matroid > $F = fano_matroid; matroid > print $F->CIRCUITS; {0 1 6} {0 2 5} {0 3 4} {1 2 3} {1 4 5} {2 4 6} {3 5 6} {0 1 2 4} {0 1 3 5} {0 2 3 6} {0 4 5 6} {1 2 5 6} {1 3 4 6} {2 3 4 5}
But you can use LABELS to make things look differently.

Code: Select all

matroid > $F->LABELS="1 2 3 4 a b c"; matroid > print $F->LABELS->[0]; 1 matroid > print rows_labeled($F->CIRCUITS,undef,$F->LABELS); 0:1 2 c 1:1 3 b 2:1 4 a 3:2 3 4 4:2 a b 5:3 a c 6:4 b c 7:1 2 3 a 8:1 2 4 b 9:1 3 4 c 10:1 a b c 11:2 3 b c 12:2 4 a c 13:3 4 a b

qichen
Posts: 8
Joined: 09 Jul 2020, 02:01

Re: Label the ground set of a matroid from 1 to n

Postby qichen » 01 Aug 2021, 11:01

Thanks a lot. :D

qichen
Posts: 8
Joined: 09 Jul 2020, 02:01

Re: Label the ground set of a matroid from 1 to n

Postby qichen » 01 Aug 2021, 12:07

But if use the following, labels in the figure are still from 0 to 6. Is it related to VISUAL()?

Code: Select all

$l=$F->LATTICE_OF_FLATS; $l->VISUAL();


Return to “Helpdesk”