The graph layout algorithm tries to lay out the tree so that the y-position of the nodes relates to the function value. Because of this layout, finding the global maximum and minimum nodes is easy. We find the highest and lowest nodes in the display.