Are there any radix/patricia/critbit trees for Python?

早过忘川 提交于 2019-11-28 23:38:06

Yes, there are some, though I'm not sure if they're suitable for your use case: but it seems none of them are what you asked for.

BioPython has a Trie implementation in C.

Ah, here's a nice discussion including benchmarks: http://bugs.python.org/issue9520

Other (some very stale) implementations:

http://pypi.python.org/pypi/radix

py-radix is an implementation of a radix tree data structure for the storage and retrieval of IPv4 and IPv6 network prefixes.

https://bitbucket.org/markon/patricia-tree/src

A Python implementation of patricia-tree

http://pypi.python.org/pypi/trie

A prefix tree (trie) implementation.

http://pypi.python.org/pypi/logilab-common/0.50.3

patricia.py : A Python implementation of PATRICIA trie (Practical Algorithm to Retrieve Information Coded in Alphanumeric).

I've recently added iteration support to datrie, you may give it a try.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!