public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
        if(node == null) return null;
        Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>();
        Map<UndirectedGraphNode, UndirectedGraphNode> map = new HashMap<UndirectedGraphNode, UndirectedGraphNode>();
        queue.add(node);
        while(!queue.isEmpty()){
            UndirectedGraphNode oldNode = queue.poll();
            UndirectedGraphNode newNode;
            if(!map.containsKey(oldNode)){
                newNode = new UndirectedGraphNode(oldNode.label);
                map.put(oldNode, newNode);
            }else{
                newNode = map.get(oldNode);
            }
            for(UndirectedGraphNode oldNeighbor : oldNode.neighbors){
                UndirectedGraphNode newNeighbor;
                if(!map.containsKey(oldNeighbor)){
                    newNeighbor = new UndirectedGraphNode(oldNeighbor.label);
                    queue.add(oldNeighbor);
                    map.put(oldNeighbor, newNeighbor);
                }else{
                    newNeighbor = map.get(oldNeighbor);
                }
                newNode.neighbors.add(newNeighbor);
            }
        }
        return map.get(node);
    }