|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Python |
Figure
shows an alternate representation of
the tree
defined in Equation
.
In this case,
the tree is represented as a set of nested regions in the plane.
In fact, what we have is a Venn diagram
which corresponds to the view that a tree is a set of sets.

Figure: An alternate graphical representation for trees.
This hierarchical, set-within-a-set view of trees is also evoked by considering the nested structure of computer programs. For example, consider the following fragment of Python code:
class D:
class E:
class F: pass
class G:
class H:
class I: pass
class J:
class K: pass
class L: pass
class M: pass
The nesting structure of this program
and the tree given in Equation