Deep copy a graph using DFS + a hash map from original node to cloned node.
DFS from the start node:
The map prevents infinite loops on cycles and ensures shared neighbors remain shared in the clone.
Deep copy a graph using DFS + a hash map from original node to cloned node.
DFS from the start node:
The map prevents infinite loops on cycles and ensures shared neighbors remain shared in the clone.