Skip to content

Commit 968b0bd

Browse files
committed
Updated readme
1 parent e08883e commit 968b0bd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,30 @@ Installation
1717

1818
pip install nodetrie
1919

20+
Motivation, design goals
21+
==========================
22+
23+
NodeTrie is a Python extension to a native C library written for this purpose.
24+
25+
It came about from a lack of viable alternatives for Python. While other trie library implementations exist, they suffer from severe limitations such as
26+
27+
* Read only structures, no insertions
28+
* High memory use for large trees
29+
* Lack of searching, particularly file mask or wild card style searching
30+
* Slow inserts
31+
32+
Existing implementations on PyPi fall into these broad categories, including Marissa-Trie (read only) and datrie (slow inserts, very high memory use).
33+
34+
NodeTrie's C library is designed to minimize memory use as much as possible and still allow arbitrary length trees that can be searched.
35+
36+
Each node only has a name associated with it which is readonly on the `Node` object.
37+
38+
Node names are always returned as unicode by `Node.name` in Python 2/3.
39+
40+
On insertion, any python string type may be used whether a type of unicode or str, converted to byte strings on insertion if needed. The default encoding is `utf-8`.
41+
42+
Deletions are not implemented.
43+
2044
Example Usage
2145
==============
2246

@@ -26,6 +50,7 @@ Example Usage
2650
2751
# This is the head of the trie, keep a reference to it
2852
node = Node()
53+
2954
# Insert a linked tree so that a->b->c->d where -> means 'has child node'
3055
node.insert_split_path(['a', 'b', 'c', 'd'])
3156
node.children[0].name == 'a'

0 commit comments

Comments
 (0)