So I am trying to clone an Object MyGraph and it contains two arraylists for vertices and edges. My code so far is:

public static MyGraph deepCopy(MyGraph G){
		MyGraph Copy = (MyGraph) G.clone();
 
		Copy.VertexG = (ArrayList<Integer>) G.VertexG.clone();
		Copy.EdgeG = (ArrayList<String>) G.EdgeG.clone();
 
		return Copy;
	}

I want the clone to be a deep copy so that it takes the vertices and edges but makes them separate from the original. The problem here is that it doesn't work adding the vertices and edges to the copy graph. I'm not sure if I can add the arraylists this way.
Any ideas how I can do it?