Ask Your Question
0

Simple tree diagram

asked 2013-02-23 21:42:22 +0100

Kaiserfilk gravatar image

updated 2015-01-13 18:05:30 +0100

FrédéricC gravatar image

How can I plot a simple tree diagram like the first one of the following link?

http://reference.wolfram.com/mathemat...

Is it possible to choose the orientation (from left to right) and display edge labels?

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2013-02-23 23:46:13 +0100

fidbc gravatar image

You can try

T=Graph()
T.add_edges([[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[1,3],[2,5],[3,7],[4,9],[5,11],[6,13]]);
T.show(layout='tree',tree_root=1,tree_orientation='down')

The manual does not specify anything about left to right orientation so it might not be currently implemented. Edge labels are disabled by default and you can enable them with the argument edge_labels=True. You can check the manual for further details.

edit flag offensive delete link more

Comments

Thank you. That's exactly what I wanted to do. Now, I'm trying to add labels but it seems that the \displaystyle command doesn't work.

Kaiserfilk gravatar imageKaiserfilk ( 2013-02-24 04:10:06 +0100 )edit

I added edge_labels=True and labels are displayed. I need to display some fractions but they are very small and I'd like to have them larger.

Kaiserfilk gravatar imageKaiserfilk ( 2013-02-24 04:32:36 +0100 )edit

If this answered your question, please mark it as accepted. Regarding the second question, this has been asked previously [here](http://ask.sagemath.org/question/664/font-size-for-edge-label).

fidbc gravatar imagefidbc ( 2013-02-24 09:03:19 +0100 )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-02-23 21:42:22 +0100

Seen: 565 times

Last updated: Feb 23 '13