Assigning all nodes in a tree a parent and children
The tree in your diagram is undirected. Undirected trees don't have a uniquely determined root because the edge&nbsp;$xy$ just means that nodes $x$ and&nbsp;$y$ are related: it doesn't specify that one is the parent of the other.

If you're told to make a particular node the root, you can do so by directing all of the edges away from the root, which you can do by depth-first search (or breadth-first search, or any other enumeration procedure).

Conversely, if the edges are directed, so $xy$&nbsp;means "$x$&nbsp;is the parent of&nbsp;$y$" (or vice-versa, if you want to adopt the opposite convention), then you can find the root by starting at any node and navigating to the parent until you find a node without a parent. Since the root is the unique node without a parent, you're done.  You might also want to check that the graph really is a tree, i.e., that it is connected and acyclic.