Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Try with

t.plot(pos=t.layout_acyclic())

It gives me good results.

Try with

t.plot(pos=t.layout_acyclic())

It gives me good results.results. According to the manual you need to have dot2tex and graphviz installed for this to work.

Try withYou can use:

t.plot(pos=t.layout_acyclic())

It gives me good results. According If you get arrows pointing up it means you don't have the dot2tex package installed, and sage does the positioning itself (by calling t.layout_acyclic_dummy()). Just run install_package('dot2tex-2.8.7-2') (perhaps the version will change one day, type optional_packages() to the manual you need to have dot2tex and graphviz installed for this to work.see all packages available).

You can also reverse manually sage's sorting:

l = t.layout_acyclic_dummy()
m = max([p[1] for p in l.values()])
t.plot(pos=dict([[v,[l[v][0],m-l[v][1]]] for v in t.vertices()]))

You can use:

t.plot(pos=t.layout_acyclic())

If you get arrows pointing up it means you don't have the dot2tex package installed, and sage does the positioning itself (by calling t.layout_acyclic_dummy()). Just run install_package('dot2tex-2.8.7-2') (perhaps the version number will change one day, type optional_packages() to see all packages available).

You can also reverse manually flip sage's sorting:positioning:

l = t.layout_acyclic_dummy()
m = max([p[1] for p in l.values()])
t.plot(pos=dict([[v,[l[v][0],m-l[v][1]]] for v in t.vertices()]))

You can use:

t.plot(pos=t.layout_acyclic())

If you get arrows pointing up it means you don't have the dot2tex package installed, installed (you can check this with sage.graphs.dot2tex_utils.have_dot2tex()), and sage does the positioning itself (by calling t.layout_acyclic_dummy()). Just run install_package('dot2tex-2.8.7-2') (perhaps the version number will change one day, type optional_packages() to see all packages available).

You can also manually flip sage's positioning:

l = t.layout_acyclic_dummy()
m = max([p[1] for p in l.values()])
t.plot(pos=dict([[v,[l[v][0],m-l[v][1]]] for v in t.vertices()]))

You can use:

t.plot(pos=t.layout_acyclic())

If you get arrows pointing up it means you don't have the dot2tex package installed (you can check this with sage.graphs.dot2tex_utils.have_dot2tex()), and sage does the positioning itself (by calling t.layout_acyclic_dummy()). Just run install_package('dot2tex-2.8.7-2') (perhaps the version number will change one day, type optional_packages() to see all packages available).

You can also manually flip sage's positioning:

l = t.layout_acyclic_dummy()
m = max([p[1] for p in l.values()])
t.plot(pos=dict([[v,[l[v][0],m-l[v][1]]] t.plot(pos=dict([[v,[l[v][0],-l[v][1]]] for v in t.vertices()]))

or rotate it like in the image in the question:

l = t.layout_acyclic_dummy()
t.plot(pos=dict([[v,[l[v][1],l[v][0]]] for v in t.vertices()]))