the code for cloning graph