public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
        HashMap<UndirectedGraphNode, UndirectedGraphNode> hashMap = new HashMap<UndirectedGraphNode, UndirectedGraphNode>();
        hashMap.put(node, new UndirectedGraphNode(node.label));
        Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>();
        queue.offer(node);
        while (!queue.isEmpty()) {
            UndirectedGraphNode cur = queue.poll();
            UndirectedGraphNode cur_copy = hashMap.get(cur);
            for (UndirectedGraphNode n : cur.neighbors) {
                if (hashMap.containsKey(n)) {
                    cur_copy.neighbors.add(hashMap.get(n));
                } else {
                    UndirectedGraphNode newNode = new UndirectedGraphNode(n.label);
                    hashMap.put(n, newNode);
                    cur_copy.neighbors.add(newNode);
                    queue.offer(n);
                }
            }
        }
        return hashMap.get(node);
    }