1. A computer-implemented method for representing NFA states efficiently, in a way permits efficient union operations, the computer-implemented method comprising: a) generating, with a computer system including at least one processor, an independent graph representing the NFA states as nodes and whether the NFA states can not be simultaneously active as edges; b) dividing, with the computer system, the nodes of the graph into a small number of maximal cliques; and c) encoding, with the computer system, each of the nodes using a number and size of the maximal cliques.