Expand description
Dictionary encoding for repeated strings.
If your data has lots of repeated strings (like node labels or edge types), dictionary encoding stores each unique string once and references it by a small integer code. A million “Person” labels becomes one string + a million 4-byte codes instead of a million strings.
§Example
let mut builder = DictionaryBuilder::new();
builder.add("Person");
builder.add("Company");
builder.add("Person"); // same as first - reuses code 0
builder.add("Person"); // reuses code 0 again
let dict = builder.build();
// Dictionary: ["Person", "Company"]
// Codes: [0, 1, 0, 0]
assert_eq!(dict.dictionary_size(), 2); // Only 2 unique strings storedStructs§
- Dictionary
Builder - Builds a dictionary encoding by streaming values through.
- Dictionary
Encoding - Stores repeated strings efficiently by referencing them with integer codes.
Traits§
- Into
Dictionary Encoding - Extension trait for building dictionary encodings from iterators.