def add_node_ids(node):
    """
    Adds node IDs to the tree (the recursive Python dict)
    in a breadth-first fasion.

    Arguments:
    node --  the root node for the tree

    Returns:
    the same tree (Python dict), but with a new key for
    each node (the ID)
    """
    nodes_to_explore = [node]
    counter = -1
    while len(nodes_to_explore) > 0:
        if len(nodes_to_explore) == 0:
            break
        current_node = nodes_to_explore.pop(0)
        counter += 1
        current_node["id"] = counter
        #classes.add(current_node["prediction"])
        
        if current_node["nodeType"] == "internal":
            nodes_to_explore.append(current_node["leftChild"])
            nodes_to_explore.append(current_node["rightChild"])
    return node