ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 24 Jul 2020 02:41:57 -0500Shelling order of a simplicial polytopehttps://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/ Hi there,
In sage a simplicial complex C has a function "is_shellable" that could return a shelling order of the facets of C. I assume that every *facet* of C, a maximal face, has dimension d-1 and that C is *pure*, every face of C is contained in a facet. The *dimension* of a complex is the dimension of a facet.
A simplicial d-dimensional polytope P is a simplicial (d-1)-dimensional complex C.P is a Polyhedron in sage. Suppose I have a *realisation* of P in R^d, coordinates of all its vertices. Is there a reasonable direct way to make use of the function "is_shellable" to obtain a shelling order of a P?
Thank you in advance, and regards,
Guillermo Thu, 23 Jul 2020 01:17:08 -0500https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/Answer by jipilab for <p>Hi there,</p>
<p>In sage a simplicial complex C has a function "is_shellable" that could return a shelling order of the facets of C. I assume that every <em>facet</em> of C, a maximal face, has dimension d-1 and that C is <em>pure</em>, every face of C is contained in a facet. The <em>dimension</em> of a complex is the dimension of a facet.</p>
<p>A simplicial d-dimensional polytope P is a simplicial (d-1)-dimensional complex C.P is a Polyhedron in sage. Suppose I have a <em>realisation</em> of P in R^d, coordinates of all its vertices. Is there a reasonable direct way to make use of the function "is_shellable" to obtain a shelling order of a P? </p>
<p>Thank you in advance, and regards,
Guillermo </p>
https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?answer=52641#post-id-52641Dear Guillermo,
The answer to your question is yes. Here is an illustration with the octahedron:
sage: P = polytopes.octahedron()
sage: Facets = {f.ambient_V_indices():f for f in P.faces(P.dimension() - 1)} # Create the vertices-indices-to-facets dictionary
sage: P.is_simplicial() # Check that P is simplicial, so we can get the boundary complex
True
sage: C = P.boundary_complex() # Create the boundary complex
sage: Order = C.is_shellable(True); Order # Get a shelling order
((0, 1, 2),
(1, 2, 5),
(1, 3, 5),
(0, 2, 4),
(0, 1, 3),
(0, 3, 4),
(2, 4, 5),
(3, 4, 5))
Finally, we can get the actual sequence of facet using our dictionary.
sage: Facet_shelling = [Facets[indices.tuple()] for indices in Order]; Facet_shelling
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]Fri, 24 Jul 2020 02:30:16 -0500https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?answer=52641#post-id-52641Comment by jipilab for <p>Dear Guillermo,</p>
<p>The answer to your question is yes. Here is an illustration with the octahedron:</p>
<pre><code>sage: P = polytopes.octahedron()
sage: Facets = {f.ambient_V_indices():f for f in P.faces(P.dimension() - 1)} # Create the vertices-indices-to-facets dictionary
sage: P.is_simplicial() # Check that P is simplicial, so we can get the boundary complex
True
sage: C = P.boundary_complex() # Create the boundary complex
sage: Order = C.is_shellable(True); Order # Get a shelling order
((0, 1, 2),
(1, 2, 5),
(1, 3, 5),
(0, 2, 4),
(0, 1, 3),
(0, 3, 4),
(2, 4, 5),
(3, 4, 5))
</code></pre>
<p>Finally, we can get the actual sequence of facet using our dictionary.</p>
<pre><code>sage: Facet_shelling = [Facets[indices.tuple()] for indices in Order]; Facet_shelling
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]
</code></pre>
https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?comment=52643#post-id-52643Sure! If you want to keep track of the development related to polyhedral geometry in Sage visit the [Polyhedral Geometry Trac Wiki](https://trac.sagemath.org/wiki/SagePolyhedralGeometry). The .boundary_complex method is in Sage since version 9.0.Fri, 24 Jul 2020 02:41:57 -0500https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?comment=52643#post-id-52643Comment by guillermo for <p>Dear Guillermo,</p>
<p>The answer to your question is yes. Here is an illustration with the octahedron:</p>
<pre><code>sage: P = polytopes.octahedron()
sage: Facets = {f.ambient_V_indices():f for f in P.faces(P.dimension() - 1)} # Create the vertices-indices-to-facets dictionary
sage: P.is_simplicial() # Check that P is simplicial, so we can get the boundary complex
True
sage: C = P.boundary_complex() # Create the boundary complex
sage: Order = C.is_shellable(True); Order # Get a shelling order
((0, 1, 2),
(1, 2, 5),
(1, 3, 5),
(0, 2, 4),
(0, 1, 3),
(0, 3, 4),
(2, 4, 5),
(3, 4, 5))
</code></pre>
<p>Finally, we can get the actual sequence of facet using our dictionary.</p>
<pre><code>sage: Facet_shelling = [Facets[indices.tuple()] for indices in Order]; Facet_shelling
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices,
A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]
</code></pre>
https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?comment=52642#post-id-52642@jipilab, thank you very much. For some reason, I had overlooked the function boundary_complex!Fri, 24 Jul 2020 02:37:20 -0500https://ask.sagemath.org/question/52630/shelling-order-of-a-simplicial-polytope/?comment=52642#post-id-52642