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

Commit

Permalink
trac #17474 adding an increasing option to digraph of polytope
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton committed Dec 16, 2014
1 parent dcf5264 commit f0e479b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sage/geometry/polyhedron/base.py
Expand Up @@ -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.
Expand All @@ -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::
Expand All @@ -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():
Expand Down

0 comments on commit f0e479b

Please sign in to comment.