Advertuse

Search This Blog

Your Ad Here

Friday, 9 June 2023

Tree vs Forest in Graph theory




In graph theory, a tree and a forest are both special types of graphs that do not contain cycles.

Here is difference between tree and forest.

 

Tree

Forest

Definition

A connected acyclic graph

A collection of disjoint trees

Components

Only one tree

Multiple trees

Connectivity

All vertices are connected

Each tree is connected but trees are disjoint

Cycles

No cycles

No cycles in individual trees

Number of Edges

n-1 (where n is the number of vertices)

Sum of edges in all trees

Root

A tree can have a designated root vertex

Each tree in the forest can have its root

Paths

Unique path between any two vertices

Paths are unique within each tree

Examples

Family tree, hierarchical structure

Multiple disconnected network components

Examples





No comments: