Are trees directed or not redirected?

I read that trees are special cases of graphs. Charts can be directed or non-oriented. but if we consider the tree as a data structure, is it a directed or undirected graph?

+12
data-structures graph directed-graph tree
source share
4 answers

Watch the tree on Wikipedia

A tree is an undirected graph.

+5
source share

Unless otherwise indicated, trees in math or graph theory are usually considered non-oriented, but in the field of computer science or programming or data structures, trees are usually considered directional and rooted.

You need to know the context of the discussion.

+25
source share

Both are acceptable. You may have some occasions when you want to be able to get off the sheet and then go back (usually to another branch), or you may want to go only down.

+6
source share

Trees are connected by acyclic graphs. this means that you should be able to go from any node u to any node v. If we say that the trees are directed, then it may not be possible to go from each node u to each node v.

In the context of rooted trees, the direction simply says which tree node is considered to be the root (starting point) or to show the parent child relations between the nodes and what it all says ... this direction does not limit the connectivity of the graph or the connection between any node and tree node. [one]


[1] if we considered the directions in the root as a real path that you can walk in a tree to go from node u to node v, then the connection would be broken, and this graph would no longer be a tree.

+3
source share

All Articles