Understanding of trees
Understanding of trees
Introduction to Trees
-
A tree is a special form of a graph that is both connected and acyclic.
-
Being connected means that there is a path between any two vertices.
-
Being acyclic means it consists of no cycles (closed pathways).
Characteristics of Trees
-
A tree with
n
vertices always hasn-1
edges. -
In a tree, there is exactly one unique path between any two vertices.
-
A tree is bipartite.
-
A tree with
n
vertices hasn^(n-2)
different labelled trees (this is covered by Cayley’s formula).
Types of Trees
-
A rooted tree is a tree with one distinguished vertex called the root. The edges are directed away from the root.
-
A tree is binary if every vertex in the tree has at most two children.
-
A tree is balanced or complete if every leaf is at the same depth or the same level in the case of a rooted tree.
Spanning Trees
-
A spanning tree of a graph is a subset that forms a tree and includes all the vertices of the graph.
-
The minimum spanning tree problem focuses on finding the spanning tree with the smallest possible total edge weight.
-
Kruskal’s algorithm and Prim’s algorithm are used to find the minimum spanning tree in a graph.
Tree Traversal Techniques
-
Depth First Search (DFS) traverses the tree as deep as possible along each branch before backtracking.
-
Breadth First Search (BFS) explores all the vertices at the present depth before moving on to vertices at the next depth level.
Knowledge of tree types, characteristics and algorithms is essential for graph theory. Trees play a vital role in data structure implementation and network communications.