diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py index 1022116055b..a2d04e2e9e2 100644 --- a/src/sage/geometry/polyhedron/base.py +++ b/src/sage/geometry/polyhedron/base.py @@ -3277,7 +3277,7 @@ def vertex_graph(self): graph = vertex_graph - def vertex_digraph(self, f): + def vertex_digraph(self, f, increasing=False): """ Return the directed graph of the polyhedron according to a linear form. @@ -3287,7 +3287,10 @@ def vertex_digraph(self, f): - `f` -- a linear form (as a tuple, list or vector) - An edge is oriented from `v` to `w` if `f(v-w) > 0`. + - ``increasing`` -- boolean (default ``False``) wether to orient + edges in the increasing direction instead. + + By default, an edge is oriented from `v` to `w` if `f(v-w) > 0`. EXAMPLES:: @@ -3301,6 +3304,8 @@ def vertex_digraph(self, f): """ from sage.graphs.digraph import DiGraph dg = DiGraph() + if increasing: + f = -vector(f) for j in range(self.n_vertices()): vj = self.Vrepresentation(j) for vi in vj.neighbors():