Amazon interview question

Graph Question - convert the graph to a tree (medium)