Vertex labels vs indices

Questions and problems about using polymake go here.
ramanath
Posts: 8
Joined: 28 Mar 2011, 15:38

Vertex labels vs indices

Postby ramanath » 07 Mar 2013, 23:04

Dear all,

I am using topaz to read faces of a simplicial complex and print facets. I find that the vertex indices that are input using INPUT_FACES get re-ordered to start from 0 compactly, so when I print FACETS I get different labels and have to match it up. E.g if my input faces are

topaz > print $sc->INPUT_FACES;
{5 6 8}
{6 8}

and my FACETs are

topaz > print $sc->FACETS;
{0 1 2}

What I want to get is {5 6 8}, ie, preserve the labels, or map it back into what was input. My input faces need not be maximal.

Is there a simple way? I see VERTEX_LABELS and VERTEX_INDICES and can do the mapping offline with some work but I was wondering if polymake has a way to do this automatically. This must be a commonly encountered need, so how do people get around it?

Sorry if it is a naive question, I am a newbie here.

thanks!

-Ram

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Vertex labels vs indices

Postby gawrilow » 07 Mar 2013, 23:34

Code: Select all

print rows_labeled($sc->FACETS, undef, $sc->VERTEX_INDICES);
does almost exactly what you want. Each row is decorated with a sequential number, but this should not disturb you.

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

Re: Vertex labels vs indices

Postby joswig » 07 Mar 2013, 23:35

What about the following?

Code: Select all

topaz > $sc=new SimplicialComplex(INPUT_FACES=>[[5,6,8],[6,8]]); topaz > print rows_labeled($sc->FACETS,undef,$sc->VERTEX_INDICES); 0:5 6 8
The second parameter "undef" can be replaced by something meaningful if you also want to give names to the facets.

ramanath
Posts: 8
Joined: 28 Mar 2011, 15:38

Re: Vertex labels vs indices

Postby ramanath » 07 Mar 2013, 23:52

Perfect! Just what I need!

Thanks very much for the quick responses.

-Ram


Return to “Helpdesk”