|
Zip and Skip Tries
|
Provides utilities for generating synthetic string datasets for benchmark testing. More...
#include <string>#include <vector>

Go to the source code of this file.
Functions | |
| std::string | get_random_word (size_t length) noexcept |
| Generates a random string of specified length. | |
| std::vector< std::string > | get_random_words (size_t length, size_t num_words, double mean_lcp_length) noexcept |
| Generates a collection of random strings with controlled commonality. | |
Provides utilities for generating synthetic string datasets for benchmark testing.
This file contains functions for generating random strings with controllable properties such as length, quantity, and shared prefix length. These synthetic datasets are used for benchmarking various trie implementations under controlled conditions.
The implementation uses a diverse alphabet containing lowercase letters, uppercase letters, digits, and special characters to generate strings with randomized content.
Definition in file synthetic.hpp.
|
noexcept |
Generates a random string of specified length.
Creates a string using characters from a predefined alphabet containing lowercase letters, uppercase letters, digits, and special characters. Each character is selected independently using a uniform random distribution.
The implementation uses C++'s standard random number facilities (std::mt19937) with either a random seed or an optional fixed seed for reproducible results.
| length | The desired length of the random string. |
Generates a random string of specified length.
Generates a random string of specified length using characters from the ALPHABET. The implementation uses a static random number generator (std::mt19937) initialized with either a random seed from std::random_device or an optional fixed seed for reproducible results.
Each character in the string is selected independently using a uniform distribution over the entire alphabet, ensuring equal probability for all characters.
| length | The desired length of the random string. |
Definition at line 59 of file synthetic.cpp.
|
noexcept |
Generates a collection of random strings with controlled commonality.
Creates a set of random strings where each string has a specified length, and pairs of strings are likely to share a common prefix of a length drawn from a Poisson distribution with the specified mean. To ensure uniqueness, each string includes a unique signature at the end.
The generated dataset has the following specific properties:
The algorithm first generates random words, then adds unique signatures, and finally creates controlled common prefixes between the strings. The unique signatures are created by encoding the string's index as a base-N number, where N is the alphabet size. The length of this signature is calculated to ensure all strings can have a unique value.
This function is particularly useful for benchmarking trie data structures with controlled LCP (Longest Common Prefix) distributions.
| length | The length of each string to generate. |
| num_words | The number of strings to generate. |
| mean_lcp_length | The mean length of the Longest Common Prefix (LCP) between strings. |
Generates a collection of random strings with controlled commonality.
Generates a collection of random strings with controlled Longest Common Prefix (LCP) properties. The implementation follows these steps:
The Poisson distribution ensures that the LCP lengths follow a realistic distribution with the specified mean, while the unique signatures guarantee that all strings remain distinct regardless of the LCP modifications.
| length | The length of each string to generate. |
| num_words | The number of strings to generate. |
| mean_lcp_length | The mean length of the Longest Common Prefix between strings. |
Definition at line 100 of file synthetic.cpp.