My question is akin to Data structure for partial multi-keys mapping?.
I have key-value pairs where the key is composed of three components (strings).
I am looking for a data structure the can efficiently perform search queries over keys, where the queries could be complete or partial specification the key (one or more components omitted). For example:
(x, y, z)
(x, *, *)
(*, y, *)
etc.
The unspecified part of the key can be either at the front, the middle or the end of the key.
My current implementation (a hash map which maps all possible partial keys to a set of values that match this partial key) is horribly slow when inserting, deleting and updating values.
(a,b,c)then the edges are(a,b), (b,c). This ends up being fairly similar to a trie over the dimensions rather than over each digit. So that(50,20,30)and(50,20,50)become basically `data[50][20] = {30,50}. You can certainly use only three (this is where the hasty not enough came from) but then you have to deal with set intersections which result in queries that aren't O(k), where k is the number of returned triples. Though that might be required if goal is to only increase speed by something like 5-10x.