graph clone using depth first graph traversal