Comments (4)
This is a good idea. We just need to think of a way to do it simply and efficiently. One option would be to encode each portion of the key as bytes and store something like a Vec<Vec<u8>>
on each "edge" of the trie (the TrieNode.key
field at the moment). We would have to deal with keys getting cut in half under this scheme, as its quite natural to want a trie keyed by something like Vec<String>
. For example, for URL routing, you could encode a path like "/download/file1.txt"
as vec!["download", "file1.txt"]
, which would split a key if "/download/file2.txt"
were already in the trie.
Another way I've thought about implementing this is to define a separator byte that can be used to delineate the different elements of the vector. For filesystem and URL paths, the byte encoding of /
could be used, as it's guaranteed not to appear in paths.
from rust_radix_trie.
Well, my thought is that is more of a user's concern to decide the split point of his/her data. Wouldn't it be more natural and useful to ask a library user to provide data already split as Vec or, if possible as an Iterable object(it is possible btw?).
In the example of Vec I think we should consider user wanting his strings to be the atomic part of the tree. If user wanted his strings to be split by some byte, or any other criteria, it's his/her decision to give us a Vec or Vec where strings are split properly already.
from rust_radix_trie.
Maybe something like the sequence trie API? https://docs.rs/sequence_trie/0.2.1/sequence_trie/
from rust_radix_trie.
That depends, if the radix trie itself is compatible with iterable structures. The other question is effectiveness of iteration-only structure and it's compatibility with different optimizations done by llvm, like vectorizations etc.
from rust_radix_trie.
Related Issues (20)
- c ffi support HOT 2
- remove() panics on non-existing element HOT 5
- Missing CI to cover windows build against stable / nightly respectively
- Question: Why is the key stored during insertion? HOT 2
- Optimization store keys HOT 1
- Implement Clone for Trie HOT 1
- Removing nonexistent keys causes prefix matching to fail HOT 4
- How to benchmark HOT 1
- Did get_ancestor match? HOT 4
- Missing TrieKey impls for paths on Windows
- Does this library support multithreading? HOT 3
- get_raw_ancestor HOT 2
- nibble_vec 0.0.5 has problem HOT 2
- implement extend trait to allow bulk updates to Trie
- get_raw_ancestor none with multiple children
- Expect a feature to get all prefix match values.
- Extremely poor memory efficiency (many times worse than Vec even with near-ideal conditions) HOT 1
- Question - how to use this to search for common strings based on prefix HOT 2
- Is `get_ancestor_value_mut` a possible method ? HOT 2
- map_with_default encodes key twice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust_radix_trie.