copy constructor for graph