*** empty log message ***
This commit is contained in:
parent
124e0dfe68
commit
b8ac6fb0c1
7
FAQ.t2t
7
FAQ.t2t
@ -25,7 +25,12 @@ one is executed?
|
|||||||
the cmph_config_set_hashfuncs. Therefore, the default hash function
|
the cmph_config_set_hashfuncs. Therefore, the default hash function
|
||||||
is reset when you call the cmph_config_set_algo function.
|
is reset when you call the cmph_config_set_algo function.
|
||||||
|
|
||||||
|
- What do I do when the following error is got?
|
||||||
|
- Error: **error while loading shared libraries: libcmph.so.0: cannot open shared object file: No such file ordirectory**
|
||||||
|
|
||||||
|
- Solution: type **export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/** at the shell or put that shell command
|
||||||
|
in your .profile file or in the /etc/profile file.
|
||||||
|
|
||||||
%!include: ALGORITHMS.t2t
|
%!include: ALGORITHMS.t2t
|
||||||
|
|
||||||
%!include: FOOTER.t2t
|
%!include: FOOTER.t2t
|
||||||
|
89
README.t2t
89
README.t2t
@ -51,7 +51,7 @@ The CMPH Library encapsulates the newest and more efficient algorithms in an eas
|
|||||||
%txt% - BMZ Algorithm.
|
%txt% - BMZ Algorithm.
|
||||||
A very fast external memory based algorithm for constructing minimal perfect hash functions
|
A very fast external memory based algorithm for constructing minimal perfect hash functions
|
||||||
for sets in the order of billion of keys in linear time. The resulting functions are not order preserving and
|
for sets in the order of billion of keys in linear time. The resulting functions are not order preserving and
|
||||||
can be stored using just 8.1 bits per key. **This algorithm is available just in the CVS for while**.
|
can be stored using just 8.1 bits per key.
|
||||||
%html% - [CHM Algorithm chm.html].
|
%html% - [CHM Algorithm chm.html].
|
||||||
%txt% - CHM Algorithm.
|
%txt% - CHM Algorithm.
|
||||||
An algorithm based on acyclic random graphs to construct minimal
|
An algorithm based on acyclic random graphs to construct minimal
|
||||||
@ -61,6 +61,15 @@ The CMPH Library encapsulates the newest and more efficient algorithms in an eas
|
|||||||
%html% [Click Here comparison.html] to see a comparison of the supported algorithms.
|
%html% [Click Here comparison.html] to see a comparison of the supported algorithms.
|
||||||
|
|
||||||
|
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
==News for version 0.5==
|
||||||
|
|
||||||
|
- A thread safe vector adapter has been added.
|
||||||
|
- [A new algorithm for sets in the order of billion of keys that requires approximately 8.1 bits per key to store the resulting MPHFs. brz.html]
|
||||||
|
- All reported bugs and suggestions have been corrected and included as well.
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
==News for version 0.4==
|
==News for version 0.4==
|
||||||
@ -88,29 +97,29 @@ Using cmph is quite simple. Take a look.
|
|||||||
|
|
||||||
```
|
```
|
||||||
#include <cmph.h>
|
#include <cmph.h>
|
||||||
|
#include <string.h>
|
||||||
// Create minimal perfect hash function from in-memory vector
|
// Create minimal perfect hash function from in-memory vector
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Creating a filled vector
|
// Creating a filled vector
|
||||||
const char *vector[] = {"aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc", "dddddddddd", "eeeeeeeeee",
|
const char *vector[] = {"aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc", "dddddddddd", "eeeeeeeeee",
|
||||||
"ffffffffff", "gggggggggg", "hhhhhhhhhh", "iiiiiiiiii", "jjjjjjjjjj"};
|
"ffffffffff", "gggggggggg", "hhhhhhhhhh", "iiiiiiiiii", "jjjjjjjjjj"};
|
||||||
unsigned int nkeys = 10;
|
unsigned int nkeys = 10;
|
||||||
// Source of keys
|
// Source of keys
|
||||||
cmph_io_adapter_t *source = cmph_io_vector_adapter(vector, nkeys);
|
cmph_io_adapter_t *source = cmph_io_vector_adapter((char **)vector, nkeys);
|
||||||
|
|
||||||
//Create minimal perfect hash function using the default (chm) algorithm.
|
//Create minimal perfect hash function using the default (chm) algorithm.
|
||||||
cmph_config_t *config = cmph_config_new(source);
|
cmph_config_t *config = cmph_config_new(source);
|
||||||
cmph_t *hash = cmph_new(config);
|
cmph_t *hash = cmph_new(config);
|
||||||
cmph_config_destroy(config);
|
cmph_config_destroy(config);
|
||||||
|
|
||||||
//Find key
|
//Find key
|
||||||
const char *key = "jjjjjjjjjj";
|
const char *key = "jjjjjjjjjj";
|
||||||
unsigned int id = cmph_search(hash, key, strlen(key));
|
unsigned int id = cmph_search(hash, key, strlen(key));
|
||||||
fprintf(stderr, "Id:%u\n", id);
|
fprintf(stderr, "Id:%u\n", id);
|
||||||
//Destroy hash
|
//Destroy hash
|
||||||
cmph_destroy(hash);
|
cmph_destroy(hash);
|
||||||
free(source);
|
cmph_io_vector_adapter_destroy(source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -120,33 +129,33 @@ Download [vector_adapter_ex1.c examples/vector_adapter_ex1.c]. This example does
|
|||||||
```
|
```
|
||||||
#include <cmph.h>
|
#include <cmph.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
// Create minimal perfect hash function from in-disk keys using BMZ algorithm
|
// Create minimal perfect hash function from in-disk keys using BMZ algorithm
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
//Open file with newline separated list of keys
|
//Open file with newline separated list of keys
|
||||||
FILE * keys_fd = fopen("keys.txt", "r");
|
FILE * keys_fd = fopen("keys.txt", "r");
|
||||||
cmph_t *hash = NULL;
|
cmph_t *hash = NULL;
|
||||||
if (keys_fd == NULL)
|
if (keys_fd == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "File \"keys.txt\" not found\n");
|
fprintf(stderr, "File \"keys.txt\" not found\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
// Source of keys
|
// Source of keys
|
||||||
cmph_io_adapter_t *source = cmph_io_nlfile_adapter(keys_fd);
|
cmph_io_adapter_t *source = cmph_io_nlfile_adapter(keys_fd);
|
||||||
|
|
||||||
cmph_config_t *config = cmph_config_new(source);
|
cmph_config_t *config = cmph_config_new(source);
|
||||||
cmph_config_set_algo(config, CMPH_BMZ);
|
cmph_config_set_algo(config, CMPH_BMZ);
|
||||||
hash = cmph_new(config);
|
hash = cmph_new(config);
|
||||||
cmph_config_destroy(config);
|
cmph_config_destroy(config);
|
||||||
|
|
||||||
//Find key
|
//Find key
|
||||||
const char *key = "jjjjjjjjjj";
|
const char *key = "jjjjjjjjjj";
|
||||||
unsigned int id = cmph_search(hash, key, strlen(key));
|
unsigned int id = cmph_search(hash, key, strlen(key));
|
||||||
fprintf(stderr, "Id:%u\n", id);
|
fprintf(stderr, "Id:%u\n", id);
|
||||||
//Destroy hash
|
//Destroy hash
|
||||||
cmph_destroy(hash);
|
cmph_destroy(hash);
|
||||||
free(source);
|
cmph_io_nlfile_adapter_destroy(source);
|
||||||
fclose(keys_fd);
|
fclose(keys_fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -176,26 +185,32 @@ utility.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: cmph [-v] [-h] [-V] [-k nkeys] [-f hash_function] [-g [-c value][-s seed] ] [-m file.mph] [-a algorithm] keysfile
|
usage: cmph [-v] [-h] [-V] [-k nkeys] [-f hash_function] [-g [-c value][-s seed] ] [-a algorithm] [-M memory_in_MB] [-b BRZ_parameter] [-d tmp_dir] [-m file.mph] keysfile
|
||||||
Minimum perfect hashing tool
|
Minimum perfect hashing tool
|
||||||
|
|
||||||
-h print this help message
|
-h print this help message
|
||||||
-c c value that determines the number of vertices in the graph
|
-c c value that determines the number of vertices in the graph
|
||||||
-a algorithm - valid values are
|
-a algorithm - valid values are
|
||||||
* bmz
|
* bmz
|
||||||
* chm
|
* bmz8
|
||||||
-f hash function (may be used multiple times) - valid values are
|
* chm
|
||||||
* djb2
|
* brz
|
||||||
* fnv
|
-f hash function (may be used multiple times) - valid values are
|
||||||
* jenkins
|
* djb2
|
||||||
* sdbm
|
* fnv
|
||||||
-V print version number and exit
|
* jenkins
|
||||||
-v increase verbosity (may be used multiple times)
|
* sdbm
|
||||||
-k number of keys
|
-V print version number and exit
|
||||||
-g generation mode
|
-v increase verbosity (may be used multiple times)
|
||||||
-s random seed
|
-k number of keys
|
||||||
-m minimum perfect hash function file
|
-g generation mode
|
||||||
keysfile line separated file with keys
|
-s random seed
|
||||||
|
-m minimum perfect hash function file
|
||||||
|
-M main memory availability (in MB)
|
||||||
|
-d temporary directory used in brz algorithm
|
||||||
|
-b parmeter of BRZ algorithm to make the maximal number of keys in a bucket lower than 256
|
||||||
|
keysfile line separated file with keys
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
==Additional Documentation==
|
==Additional Documentation==
|
||||||
|
Loading…
Reference in New Issue
Block a user