Crates.io | ab-radix-trie |
lib.rs | ab-radix-trie |
version | 0.2.1 |
source | src |
created_at | 2023-12-25 12:23:26.286172 |
updated_at | 2024-03-27 13:42:47.265369 |
description | A compressed radix trie implementation supporting matching rules |
homepage | https://github.com/avnerbarr/radix-trie |
repository | https://github.com/avnerbarr/radix-trie |
max_upload_size | |
id | 1080207 |
size | 56,477 |
Radix-trie implementation i.e. compressed prefix-trie
https://en.wikipedia.org/wiki/Radix_tree
serde
Approximately:
insertion O(depth of trie)
retrieval O(depth of trie)
deletion O(depth of trie)
Space - I don't know really, but it will behave according to ~O(entropy of text) - Similar texts are compressed together - i.e. "ABC", "ABCD" will occupy O("ABCD") space split into "ABC" and "D"
I suggest checking out the examples and the tests for some patterns
The basic usage is along these lines
let mut trie: Trie<i32> = Trie::new();
trie.insert("romanus", None);
trie.insert("romulus", Some(10));
trie.insert("rubens", None);
trie.insert("ruber", None);
trie.insert("rubicon", None);
trie.insert("rubicundus", None);