Ask Your Question
0

Simple tree diagram

asked 12 years ago

Kaiserfilk gravatar image

updated 10 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

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.

Preview: (hide)
link

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 ( 12 years ago )

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 ( 12 years ago )

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 ( 12 years ago )

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: 12 years ago

Seen: 593 times

Last updated: Feb 23 '13