How do I understand Hilbert's map in this answer? The author of the answer has mapped the hash value (integer) of some strings to a 2D image. I understand that Hilbert's curve is a technique for 1D <=> 2D transformation which preserves locality of the points.
My question is, what can I infer from this 2D image about the different hashing algorithms? I understand that two strings having nearby hash values are transformed to nearby dots in the image (but the opposite is not true). But, what information does this say to me? Do they say any information about collisions? If yes, how ?
NOTE: The author's cooment in his answer in the link: i assume you mean the images though. For "linear" map i created a square bitmap of size nxn, (where n = Ceil(sqrt(hashTable.Capacity))). Rather than simply black for list entry is occupied and white for list entry is empty, i used an HSLtoRGB function, where the hue ranged from 0 (red) to 300 (magenta). White is still an "empty list cell". For the Hilbert map i had to hunt wikipedia for the algorithm that turns an index into an (x,y) coordinate. – Ian Boyd
- I understand why the author of the answer uses n=Ceil(sqrt(hashTable.Capacity)) (my guess: magnitude of area of the image = length of hash table)
- I understand white color says that no string has been hashed to those locations. But what do the remaining colors say?
nearby hash values are transformed to nearby dots in the image (but the opposite is not true)
That's precisely the point of the Hilbert map. When using it, the converse is mostly true as well, although not always.