[sage-support] Binary Tree

30 views
Skip to first unread message

Santanu Sarkar

unread,
Apr 29, 2010, 2:19:38 AM4/29/10
to sage-s...@googlegroups.com
Hi,
 How one can create a binary tree and cut some of its branches
under some conditions continuously in Sage?

With regards,
Santanu

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
Message has been deleted

Nathann Cohen

unread,
Apr 29, 2010, 5:09:04 AM4/29/10
to sage-support
Well, we still have a generator for binary trees :

http://www.sagemath.org/doc/reference/sage/graphs/graph_generators.html#sage.graphs.graph_generators.GraphGenerators.BalancedTree

And if you want to test whether a graph is a binary tree ( all the
internal vertices have degree 3, except the root which is of degree
2), this should do :

g.is_tree() and max(g.degree()) == 3 and g.degree().count(2) == 1

Nathann
Reply all
Reply to author
Forward
0 new messages