1. A method for representing a binary trie, the binary trie representing a set of values and comprising a plurality of leaf node and a plurality of non-leaf nodes, the method comprising: using a processor and a memory for: determining, for each of the plurality of non-leaf nodes of the binary trie, a shape of a respective sub-tree rooted at the non-leaf node of the binary trie; constructing a shape graph from the binary trie based on the shapes of the sub-trees rooted at the non-leaf nodes of the binary trie, wherein the shape graph represents the set of values, wherein the shape graph comprises: a terminating vertex that represents the plurality of leaf nodes of the binary trie; and a plurality of vertices that represent a respective plurality of unique shapes of the sub-trees rooted at the non-leaf nodes of the binary trie, wherein the plurality of vertices comprises a first vertex, and wherein the first vertex represents a first shape of at least a first sub-tree rooted at a first non-leaf node of the binary trie and a second sub-tree rooted at a second non-leaf node of the binary trie; and storing the shape graph.