Given an undirected graph in which each node has a Cartesian coordinate in space that has the general shape of a tree, is there an algorithm to convert the graph into a tree, and find the appropriate root node?

Note that our definition of a "tree" requires that branches do not diverge from parent nodes at acute angles.

See the example graphs below. How do we find the red node?

Example input graph Example output tree

Edit
Report