Thinking in Pictures

Graphs

Let S be a set and R: S x S be a relation on S.
The graph G = (S,R) is a picture of the relation.

Example: X = {a,b}, S = powerset(X), R = {[x,y] | x is a proper subset of y}

Each member of S is a node in the graph, represented by a dot.
Each member of R is an arc (or an edge), represented by an arrow.

An arrow, x -> y, represents an element [x,y] in R:
y is called the head of the arrow (as in arrowhead)
and x is called the tail of the arrow

In our example, one of the edges (arcs) is the arrow {} -> {a}

The types of graphs that we will be be using are directed graphs .
We can identify a graph as being a directed graph because the arcs are arrows , and not just lines ; directed means that we have to follow the directions of the arrows .

Definitions


Trees

A tree is a directed graph which:
  1. has no (directed) cycles, i.e., it is acyclic.
  2. has one single node, called the root of the tree, which has in-degree 0
  3. all other nodes have in-degree 1
  4. there is a path from the root to every node
Other properties of a tree:
  1. The path from the root to a given node is unique
  2. The #arcs = #nodes-1
    (Hmmm, This seems like something we could prove using Induction!!)
  3. The subset of nodes that have out-degree 0 are called the leaf nodes.
Basic Tree Anatomy:

We always draw a tree upside down , with the root at the top of the picture, so we don't need the arrowheads.

Proving Properties of Trees

In order to prove properties about trees, we need to focus on what they are composed of: nodes and edges. Since we can count the nodes and edges (add them up), the number of nodes and/or edges is a Natural Number! So, it seems you are forever doomed to proving properties of trees using Mathematical Induction. (Sigh!)

To prove properties about trees (like #2 in the "Other properties..." above, we need a Recursive Definition of a Tree. In Computer Science, Binary Trees are typically the ones we prove properties about, because they are the most prevalent structures, both theoretically and in practice (searching and sorting algorithms).

(Recursive) Definition: Binary Tree

A Binary Tree is a set of nodes T, such that either:
  1. (Basis) T is empty
  2. (Recursion) T contains a distinguished node r, called the root of T, and the other nodes (T-{r}) are divided into two disjoint sets, called the left subtree of r and the right subtree of r , each of which in itself is a Binary Tree.

More Tree definitions:
©Elaine Wenderholm All Rights Reserved
Last modified: Thu Sep 17 10:56:20 EDT 1998