All are graph-based data structures. Roughly speaking, a graph is a structure defined by a set of points P
and a set of edges A
, where an element a
of the whole A
has two attributes, a.origem
and a.destino
, both of which a.origem
and a.destino
belong to the set P
.
A graph can be fully connected (connected graph), or it can have totally independent parts (disconnected graph). A disconnected graph means that there are points p1
and p2
such that it is not possible to navigate from p1
and get into p2
by the edges defined in A
.
A tree is a type of connected graph in which every point is bound to 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 graphs and trees in this answer are great, including even very intuitive drawings.
Related: https://answall.com/q/22245/57801
– Don't Panic