Implement to clone a connected undirected graph.