Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Clone each node once and store it in a map keyed by node value. DFS edges, creating clone + wiring neighbors recursively.
The map guarantees one clone per original node and prevents infinite recursion in cycles while still reconstructing the full edge structure.
Updated Feb 2026