Trees
A connected graph without any cycles is called a tree.
- A tree always has edges.
- There is always a unique path between any two vertices in a tree.
A graph (not necessarily connected) without any cycles is called a forest. In such graph, each connected graph is a tree.
Rooted Trees
In a tree we can specify a special vertex, called the root. Any vertex can be the root.
The root is chosen to be .
- ancestors is just .
- ancestors are and .
- children are and .
- descendants are and .
- The leaves are , , and .
Parent
The parent of a vertex is the first vertex in the unique path to the root.
We call the parent of v
,
The root has no parent.
Ancestors
The ancestors of a vertex are its parent and its parent's parent, etc. All the way to the root.
We call the set of ancestors of a vertex v
, .
- If
v
is the root, then - If
v
is not the root, then
Children
The children of a vertex are all its neighbors except its parent.
Descendants
The descendants of a vertex is all its children, all its children's children, etc.
We call the set of children of a vertex v
, and the set of descendants .
- If the vertex is the root then , otherwise
- The descendants are given by:
Why is there no base case?
It exists, it just built in to the notation. If then the big union will disappear.
Leaf
A vertex without children is called a leaf.
Subgraph
Induced Subgraph
Subtree
Spanning Tree
Use Cases
- In networking, we often identiy a spanning tree of the network and only send packets along the edge of the spanning tree. This prevents packets from going around the network in a cycle.
- The graph of the shortest paths from a vertex will form a rooted spanning tree.
Vocabulary
Cannot find definitions for "intrinsic".
Cannot find definitions for "descendants".