Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

If i have a nested list representing nodes in a binary tree, {3, {2, {1, None, None}, None}, None}, what is the easiest way to show the hierarchy, without all the List heads being displayed as intermediate nodes?

share|improve this question
    
Please give an example of what you do want. –  Mr.Wizard Sep 25 '13 at 21:19
add comment

1 Answer 1

up vote 5 down vote accepted

I guess what you want with your example input is the following

tree = {3, {2, {1, None, None}, None}, None};
TreeForm[tree //. {root_, left_, right_} :> root[left, right]]

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.