Clone an undirected graph. Loop exits