public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
            if (node == null)
                return null;

            Map<UndirectedGraphNode, UndirectedGraphNode> cloneNodes = new HashMap<UndirectedGraphNode, UndirectedGraphNode>();
            Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>();

            queue.add(node);
            cloneNodes.put(node, new UndirectedGraphNode(node.label));

            while (!queue.isEmpty()) {
                UndirectedGraphNode cur = queue.poll();
                UndirectedGraphNode clone = cloneNodes.get(cur);

                for (UndirectedGraphNode neighbor : cur.neighbors) {
                    if (cloneNodes.get(neighbor) == null) {
                        UndirectedGraphNode cloneNeighbor = new UndirectedGraphNode(
                                neighbor.label);
                        cloneNodes.put(neighbor, cloneNeighbor);
                        queue.add(neighbor);
                    }

                    clone.neighbors.add(cloneNodes.get(neighbor));
                }

            }
            return cloneNodes.get(node);
        }