All are graph-based data structures. In general, a graph is a structure defined by a set of points P
and a set of A
edges, where a a
element of the A
set has two attributes, a.origem
and a.destino
both a.origem
and a.destino
belong to the P
set.
A graph can be fully connected (connected graph), or it can have totally independent parts (disconnected graph). A disconnected graph means that there are p1
and p2
points such that it is not possible to navigate from p1
to p2
by the edges defined in A
.
A tree is a type of connected graph where every point is the destination of only one source.
A forest is a possibly disconnected graph such that for each connected unit you have a tree. A connected forest is a tree.
As @Everson commented on the question, the explanation of trees in this answer is great, including even intuitive designs.