Google interview question

Simple bfs problem and one MST