3

I have a dense tree. I drew it using the forest package. The code is given below. It may be inefficient, but I am looking to move forward with the minimum code disruption possible. The questions I have are:
1. The tree is asymmetric. So, the default alignment is by level. How do I align all leaves at the same level?
2. How do I make some nodes squares while others remain circles?
3. How do I color a path a different color from root to a particular leaf?
4. I use \resizebox to fit the tree in the page. Assuming people who're seeing the tree turn the page into landscape mode, is there a global option I can set to turn all node text vertically?

Any other suggestions/ideas on how to best present this tree are welcome.

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\geometry{paper=a5paper}
\usepackage{graphics}
\usepackage[T1]{fontenc}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage[toc,page]{appendix}
\usepackage{tikz}
\usetikzlibrary{shapes, positioning}
\usepackage{color,soul}
\usepackage{url}
\usepackage{tikz-qtree}
\usepackage{forest}

\begin{document}

\resizebox{!}{\textheight}{%
\begin{forest} %Figure out how to align edge labels with the edge
for tree={grow=east,circle,draw, align=center}
[\tiny{HP}
    [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}  %not built
      [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}} % not built and closed
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{HP}          
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]
          ]
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
            [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                      %Last line copied for NB and closed. No Ip. 
          ]   
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ] 
          ]                 
        ]
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ] 
          ]           
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
            [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ] 
          ]          
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ] 
          ]                 
        ]
      ] 
     [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}} % not built and open
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
           [\tiny{HP}
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     
          ]
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}   
           [\tiny{HP} %last line I added
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     %last line I added
          ]   
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
           [\tiny{HP} %last line I added
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     %last line I added
          ]         
        ]
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
           [\tiny{HP} %last line I added
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     %last line I added
          ]           
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
           [\tiny{HP} %last line I added
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     %last line I added  
          ]          
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
           [\tiny{HP} %last line I added
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
            ]                   
            ]     %last line I added
          ]                 
        ]
      ] 
    ]
    [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}    % built
      [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}} % built and closed
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]       
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]          
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]                 
        ]
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]           
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]         
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
                [\tiny{G}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]
          ]                 
        ]      
      ]  
      [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}} % built and Open
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]           
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]          
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]                 
        ]
        [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]           
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]          
          [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{IP}
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
                [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                    [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]                
                ]                   
            ]     
          ]                 
        ]      
      ]  
    ]
]
\end{forest}
    }           
\end{document}

2 Answers 2

7

UPDATE Code works without modification with the new version (2) of forest.


  1. The tree is asymmetric. So, the default alignment is by level. How do I align all leaves at the same level?

This can be accomplished by setting tier=<tier name> for all terminal nodes. To do this automatically, add this code to for tree:

if n children=0{
  tier=terminal
}{}
  1. How do I make some nodes squares while others remain circles?

You can add shape=rectangle to those you want to be non-circles. If you want to force them to be squares, you can text their width and height but this might have odd results. Or is there a pattern to the ones you want to be square and the ones you want to be circular?

  1. How do I color a path a different color from root to a particular leaf?

You can use node walk to trace the path back from leaf to root. For example, here's a style which takes one argument (the colour) and colours the path back to the root in that colour:

\forestset{
  colour my roots/.style={
    before typesetting nodes={
      edge=#1,
      for ancestors={
        edge=#1,
        #1,
      },
      #1,
    }
  }
}

To use it, you just add colour my roots=<colour> to the node of your choice. (Doesn't have to be a leaf - it will start from wherever it is. Note that if you use this style more than once, the root node will end up in the last colour used, as will any common path segments.

Here's a simple example:

root colouring

\documentclass[tikz, border=10pt, multi]{standalone}
\usepackage{forest}
\forestset{
  colour my roots/.style={
    before typesetting nodes={
      edge=#1,
      for ancestors={
        edge=#1,
        #1,
      },
      #1,
    }
  },
  my edge label/.style={
    edge label={
      node [midway, fill=white, font=\scriptsize] {#1}
    }
  }
}
\begin{document}
\begin{forest}
  for tree={
    circle,
    inner sep=1pt,
    l sep+=5pt,
    draw,
    align=center,
    if n children=0{
      tier=terminal
    }{},
  }
  [HP
    [IP, my edge label=NB
      [ABC
        [DEF]
        [GEH, colour my roots=blue]
      ]
      [HIJ
        [LMN, colour my roots=red
          [OPQ]
        ]
        [RST]
      ]
    ]
  ]
\end{forest}
\end{document}

Here's a sample result:

dense tree

  1. I use \resizebox to fit the tree in the page. Assuming people who're seeing the tree turn the page into landscape mode, is there a global option I can set to turn all node text vertically?

Don't. This complicates things unnecessarily. Instead, draw the tree with the default direction of growth and put it in a landscape environment. (Or use sidewaysfigure if you don't want the page itself to be turned.

tree in landscape

Complete code:

\documentclass[a5paper]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{forest,pdflscape}
\forestset{
  colour my roots/.style={
    before typesetting nodes={
      edge=#1,
      for ancestors={
        edge=#1,
        #1,
      },
      #1,
    }
  }
}
\begin{document}
\newlength\myheight
\setlength\myheight{\textheight}%
  \begin{landscape}
    \noindent
  \resizebox{\myheight}{!}{%
  \begin{forest} %Figure out how to align edge labels with the edge
    for tree={
      circle,
      draw,
      align=center,
      if n children=0{
        tier=terminal
      }{}
    }
  [\tiny{HP}
      [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}  %not built
        [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}} % not built and closed
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
              [\tiny{HP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}, for tree={shape=rectangle}
              [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}, colour my roots=blue]
                  ]
              ]                      %Last line copied for NB and closed. No Ip.
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
              [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
          ]
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
              [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
              [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}, shape=rectangle
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}, colour my roots=red]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
              [\tiny{HP}          %1st line copied for NB and closed. No IP involved here
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
          ]
        ]
       [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}} % not built and open
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
             [\tiny{HP}
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
             [\tiny{HP} %last line I added
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]     %last line I added
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
             [\tiny{HP} %last line I added
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]     %last line I added
            ]
          ]
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
             [\tiny{HP} %last line I added
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]     %last line I added
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
             [\tiny{HP} %last line I added
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]     %last line I added
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
             [\tiny{HP} %last line I added
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{NB}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
              ]     %last line I added
            ]
          ]
        ]
      ]
      [\tiny{IP},edge label={node[midway,fill=white,font=\scriptsize]{B}}    % built
        [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}} % built and closed
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
          ]
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
                  [\tiny{G}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
            ]
          ]
        ]
        [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}} % built and Open
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{L}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
          ]
          [\tiny{C},edge label={node[midway,fill=white,font=\scriptsize]{H}}
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{L}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}, colour my roots=green!50!black]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{M}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
            [\tiny{25},edge label={node[midway,fill=white,font=\scriptsize]{H}}
              [\tiny{IP}
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{C}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
                  [\tiny{G},edge label={node[midway,fill=white,font=\scriptsize]{O}}
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{L}}]
                      [\tiny{35},edge label={node[midway,fill=white,font=\scriptsize]{H}}]
                  ]
              ]
            ]
          ]
        ]
      ]
  ]
  \end{forest}%
}%
\end{landscape}
\end{document}

This makes minimal changes to your code. Do note, however, that you could make life much, much simpler for yourself if you used a couple of styles rather than repeating code so often.

In fact, just adding font=\tiny to for tree would save writing \tiny{} around the content of every node.

If you can manage a style as well, the labels can be simplified greatly. If there is a pattern to the labels or content, you could automate the tree further. If not, you'd get something like this:

\documentclass[a5paper]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{forest,pdflscape}
\forestset{
  colour my roots/.style={
    before typesetting nodes={
      edge=#1,
      for ancestors={
        edge=#1,
        #1,
      },
      #1,
    }
  },
  my edge label/.style={
    edge label={
      node [midway, fill=white, font=\scriptsize] {#1}
    }
  }
}
\begin{document}
\newlength\myheight
\setlength\myheight{\textheight}%
  \begin{landscape}
    \noindent
  \resizebox{\myheight}{!}{%
  \begin{forest} %Figure out how to align edge labels with the edge
    for tree={
      circle,
      draw,
      align=center,
      if n children=0{
        tier=terminal
      }{},
      font=\tiny
    }
  [HP
      [IP, my edge label=NB  %not built

...

      ]
  ]
  \end{forest}%
}%
\end{landscape}
\end{document}

which is still much less cluttered and, certainly, less repetitive typing!

Finally, if your actual tree is anything at all like this, you need to rethink the way you are presenting this information.

Nobody will be able to read anything this minute. Even if people read electronically only and can zoom away (but why stick to a tiny page area in that case? Really big electronic paper is still cheap!), it is not going to be at all obvious that there is anything much worth zooming for.

At best, you will irritate your readers. At worst, they will simply give up in frustration.

3
  • Note that I had to delete a chunk of code in order to comply with the maximum length. However, since the OP doesn't want the too-changed version, this is only for demonstration purposes so I've snipped most of the middle of the tree from the use-styles-and-type-less version.
    – cfr
    Oct 17, 2015 at 23:41
  • yes, this is my actual tree & I agree that it isn't presentable in it's current form and need to rethink how I'm presenting this. But for now, this is exactly what I was looking for! All suggestions are helpful even if I ultimately decide to present only a section of the tree. Thanks!
    – Roe1
    Oct 18, 2015 at 20:36
  • @Roe1 If the leaves did not all have to be level, you could present the tree with greater depth so things could be less shrunken. Or, of course, using standard paper would also help.
    – cfr
    Oct 18, 2015 at 21:09
5
  1. Add to preamble: where n children=0{tier=bottom}{} (don't forget the comma before!)

  2. Add option rectangle to those nodes

  3. At that leaf, add for ancestors={edge=red}

  4. Use tikz's key rotate to rotate a node. In your case, add for tree={rotate=90} to the preamble, and rotate=90 to all the edge label nodes.

I would actually recommend defining a style to specify edge labels. Put this in your preamble:

my edge label/.style={edge label={node[midway,fill=white,font=\scriptsize]{#1}}},

and then specify the edge label by writing my edge label=NB etc.

1
  • I was quicker by 2 minutes ;). I wasn't sure if 'path' meant just the branches or the nodes as well. I coloured everything!
    – cfr
    Oct 17, 2015 at 23:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .