Ask Your Question
0

Simple tree diagram

asked 2013-02-23 14:42:22 -0500

Kaiserfilk gravatar image

updated 2015-01-13 11:05:30 -0500

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 16:46:13 -0500

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-23 21:10:06 -0500 )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-23 21:32:36 -0500 )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 02:03:19 -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-02-23 14:42:22 -0500

Seen: 249 times

Last updated: Feb 23 '13