You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,30 @@ Installation
17
17
18
18
pip install nodetrie
19
19
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
+
20
44
Example Usage
21
45
==============
22
46
@@ -26,6 +50,7 @@ Example Usage
26
50
27
51
# This is the head of the trie, keep a reference to it
28
52
node = Node()
53
+
29
54
# Insert a linked tree so that a->b->c->d where -> means 'has child node'
0 commit comments