Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
added simplicity and simpliciality to polyhedra
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Feb 12, 2020
1 parent 1d465c7 commit 3406851
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/doc/en/thematic_tutorials/geometry/polyhedra_quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ List of Polyhedron methods
:meth:`~sage.geometry.polyhedron.base.Polyhedron_base.dimension` | alias of dim
:meth:`~sage.geometry.polyhedron.base.Polyhedron_base.f_vector` | the `f`-vector (number of faces of each dimension)
:meth:`~sage.geometry.polyhedron.base.Polyhedron_base.neighborliness` | highest cardinality for which all `k`-subsets of the vertices are faces of the polyhedron
:meth:`~sage.geometry.polyhedron.base.Polyhedron_base.simpliciality` | highest cardinality for which all `k`-faces are simplices
:meth:`~sage.geometry.polyhedron.base.Polyhedron_base.simplicity` | highest cardinality for which the polar is `k`-simplicial

**Implementation properties**

Expand Down
69 changes: 69 additions & 0 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2915,6 +2915,42 @@ def combinatorial_polyhedron(self):
from sage.geometry.polyhedron.combinatorial_polyhedron.base import CombinatorialPolyhedron
return CombinatorialPolyhedron(self)

def simplicity(self):
r"""
Return the largest `k` such that the polytope is `k`-simple.
Return the dimension in case of a simplex.
A polytope `P` is `k`-simple, if every `(d-1-k)`-face
is contained in exactly `k+1` facets of `P` for `1 <= k <= d-1`.
Equivalently it is `k`-simple if the polar/dual polytope is `k`-simplicial.
EXAMPLES::
sage: polytopes.hypersimplex(4,2).simplicity()
1
sage: polytopes.hypersimplex(5,2).simplicity()
2
sage: polytopes.hypersimplex(6,2).simplicity()
3
sage: polytopes.simplex(3).simplicity()
3
sage: polytopes.simplex(1).simplicity()
1
The method is not implemented for unbounded polyhedra::
sage: p = Polyhedron(vertices=[(0,0)],rays=[(1,0),(0,1)])
sage: p.simplicity()
Traceback (most recent call last):
...
NotImplementedError: this function is implemented for polytopes only
"""
if not(self.is_compact()):
raise NotImplementedError("this function is implemented for polytopes only")
return self.combinatorial_polyhedron().simplicity()

def is_simple(self):
"""
Test for simplicity of a polytope.
Expand All @@ -2934,6 +2970,39 @@ def is_simple(self):
if not self.is_compact(): return False
return self.combinatorial_polyhedron().is_simple()

def simpliciality(self):
r"""
Return the largest `k` such that the polytope is `k`-simplicial.
Return the dimension in case of a simplex.
A polytope is `k`-simplicial, if every `k`-face is a simplex.
EXAMPLES::
sage: polytopes.cyclic_polytope(10,4).simpliciality()
3
sage: polytopes.hypersimplex(5,2).simpliciality()
2
sage: polytopes.cross_polytope(4).simpliciality()
3
sage: polytopes.simplex(3).simpliciality()
3
sage: polytopes.simplex(1).simpliciality()
1
The method is not implemented for unbounded polyhedra::
sage: p = Polyhedron(vertices=[(0,0)],rays=[(1,0),(0,1)])
sage: p.simpliciality()
Traceback (most recent call last):
...
NotImplementedError: this function is implemented for polytopes only
"""
if not(self.is_compact()):
raise NotImplementedError("this function is implemented for polytopes only")
return self.combinatorial_polyhedron().simpliciality()

def is_simplicial(self):
"""
Tests if the polytope is simplicial
Expand Down

0 comments on commit 3406851

Please sign in to comment.