Create a deep copy of an undirected graph starting from a given node.
You are given a reference to a node in a connected undirected graph. Each node has a value and a list of its neighboring nodes.
Return a deep copy of the graph starting from that node. The cloned graph should contain new nodes with the same values and the same neighbor relationships, but none of the original nodes should be reused.
If the given node is empty, return an empty result.
node.Return a reference to the cloned node corresponding to the input node.
Example 1
Input
node = 1 1: [2,4] 2: [1,3] 3: [2,4] 4: [1,3]
Output
A cloned graph whose starting node has value 1 and the same adjacency relationships.
Explanation
The clone should contain four newly created nodes. The neighbor structure matches the original graph, but every node in the result is a distinct object.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.