Pergunta de entrevista da empresa Google

It was a graph question. Given a cartesian plane, create a method for adding a point then return a shortest edge between 2 points. if there's only one point, return null.