Ask Your Question
0

Generating plane triangilation

asked 2013-12-21 07:22:30 -0500

hbm gravatar image

updated 2015-01-14 07:09:42 -0500

FrédéricC gravatar image

Does sage have a function that generates plane triangulations? Something like PLANTRI? If not, is it possible to use plantri from within sage and how?

Thank you

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
3

answered 2013-12-21 10:12:04 -0500

fidbc gravatar image

updated 2013-12-21 10:12:28 -0500

If you have plantri installed and somewhere in your PATH variable you can easily adapt the code of graphs.nauty_geng to make it work with plantri. Something along the following lines might do the job:

def plantri(self, options=""):
   import subprocess
   sp = subprocess.Popen("plantri -g {0}".format(options), shell=True,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE, close_fds=True)
   gen = sp.stdout
   while True:
       try:
           s = gen.next()
       except StopIteration:
           raise StopIteration("Exhausted list of graphs from plantri")
       G = graph.Graph(s[:-1], format='graph6')
       yield G
edit flag offensive delete link more

Comments

Thank you very much.

hbm gravatar imagehbm ( 2013-12-21 10:18:02 -0500 )edit

Would this work for all OS or just Unix/Linux system?

hbm gravatar imagehbm ( 2013-12-21 10:25:26 -0500 )edit

You're welcome. Not sure about that, I've only tested it on OSX and Linux.

fidbc gravatar imagefidbc ( 2013-12-21 10:35:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-12-21 07:22:30 -0500

Seen: 213 times

Last updated: Dec 21 '13