1. A method comprising: by one or more computing devices, constructing a binary decision diagram (BDD) for representing one or more sets of data, wherein the BDD comprises one or more nodes, and each of the one or more nodes is encoded using n bits; while each of the one or more nodes is encoded using n bits, iteratively: adding data from the one or more sets of data to the BDD; compressing the BDD; and determining a compression rate of the BDD; and if the compression rate of the BDD drops below a first threshold, then encoding each of the one or more nodes of the BDD using n+d bits.