Amazon interview question

Given a graph find if it is a tree