Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 6 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

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.