Are Trees Directed or Undirected Graphs?

See Tree on Wikipedia :

A tree is an undirected graph.


Both are acceptable. You may have some cases where you want to be able to go up from a leaf and then go back down (usually in another branch), or you may want to be able to go only down.


Trees are connected acyclic graphs. that means you should be able to traverse from any node u to any node v. If we say trees are directed then it may not be possible to traverse from every node u to every node v.

In context of rooted trees, direction just tells which node of tree is treated as root (starting point) or to show parent child relationship between nodes and that's it all it says ... this direction does not limit the connectivity of graph or a connection between any node u to node v of tree.[1]


[1] if we considered directions in rooted as actual path which can be traversed in tree to go from node u to node v, then connectivity would be broken and that graph would not be a tree any more.


Unless qualified otherwise, trees in Mathematics or Graph Theory are usually assumed to be undirected, but in Computer Science or Programming or Data Structure, trees are usually assumed to be directed and rooted.

You need to be aware of the context of discussion.