cpp implementation of Clone Graph