Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Bidirectional lookup algorithm? (Solution.)

by bitingduck (Chaplain)
on Jan 24, 2015 at 17:14 UTC ( [id://1114375]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Bidirectional lookup algorithm? (Solution.)
in thread Bidirectional lookup algorithm? (Updated: further info.)

That's interesting how much extra space it takes to build the structure, and possibly part of why such algorithms aren't already coded up in a lot of libraries, given that the CHM algorithm dates back to 1992. I was also curious if the setup time would be too much - it wasn't clear that it really would do the generation in O(M+N) time with real data sets.

It was interesting research-- I read through the whole thread and got curious why there aren't more canned packages that do minimal perfect hashing, given what it seems the value could be for some modern applications. I'm still not sure I completely understand why there aren't (though it's probably the memory cost vs. time cost). Then it kind of took me down a rabbit hole of interesting reading. My first inclination was to do something with trees and indexed lists of child nodes- it's more space intensive than a pair of hashes, but probably a little faster than a binary search.

Replies are listed 'Best First'.
Re^5: Bidirectional lookup algorithm? (Solution.)
by BrowserUk (Patriarch) on Jan 24, 2015 at 19:22 UTC
    That's interesting how much extra space it takes to build the structure, and possibly part of why such algorithms aren't already coded up in a lot of libraries, given that the CHM algorithm dates back to 1992.

    The DAG is only needed whilst the algorithm is searching for the perfect hash function. Once the hash function has been discovered, the DAG is discarded and the data can be stored in a very simple hash structure; basically just an array indexed by the generated hash function.

    For many applications -- spell checkers and the like -- where the dictionary is known in advance, the hash function is generated in a separate process and the simple hash table generated and stored to disk. The applications that use the hashtable just load it up at startup and use the generated hash function to look things up in the table.

    It's because my application generates essentially random datasets at runtime, and a different dataset for each run, that makes CHM unsuitable for my application.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1114375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found