Hi, do you specifically need to use a graph? Because there is a special object for binary trees.
Anyway, here is the code for the labelled binary tree corresponding to what you want: sage: LBT = LabelledBinaryTree sage: a = LBT([], label='a') sage: b = LBT([], label='b') sage: c = LBT([], label='c') sage: d = LBT([], label='d') sage: tree = LBT([LBT([a,b], '+'), LBT([c,d],'-')],'*') sage: tree *[+[a[., .], b[., .]], -[c[., .], d[., .]]] sage: view(tree) Sadly, there is no graph syntax like to create the tree. And in general, labelled binary trees are not that well handled. But anyway, if you have some specific use cases or suggestions, they could be implemented! Best, Viviane 2014-11-25 14:33 GMT+01:00 kcrisman <[email protected]>: > > Hi! I don't think this is necessarily a notebook question, so I'm > forwarding this to sage-support where it is morel likely to get some > responses. Good luck! > > >> Hi, >> >> I would like to get a left and right subtree from a vertice. >> First i used Graph abd option layout. The graph don't respect the order >> of suns. >> >> g=DiGraph({"*":["+","-"],"-":["d","c"],"+":["a","b"]}) >> >> g.order(), g.size() >> g.vertices() >> g.edges() >> g.show(layout='tree') >> >> Does someone have an idea? How to plot the tree in order abd get right >> and left subtrees? >> Dominique > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
