Skip to main content

A Generalized Suffix Tree for any iterable, with Lowest Common Ancestor retrieval

Project description

A Generalized Suffix Tree for any Python iterable, with Lowest Common Ancestor retrieval.

pip install suffix-tree
from suffix_tree import Tree

>>> tree = Tree ({ 'A' : 'xabxac' })
>>> tree.find ('abx')
True
>>> tree.find ('abc')
False

This suffix tree:

  • works with any Python iterable, not just strings, if the items are hashable,

  • is a generalized suffix tree for sets of iterables,

  • uses Ukkonen’s algorithm to build the tree in linear time,

  • does constant-time Lowest Common Ancestor retrieval,

  • outputs the tree as GraphViz .dot file.

Three different builders have been implemented:

  • one that follows Ukkonen’s original paper ([Ukkonen1995]),

  • one that follows Gusfield’s variant ([Gusfield1997]),

  • and one simple naive algorithm.

PyPi: https://pypi-hypernode.com/project/suffix-tree/

[Ukkonen1995]

Ukkonen, Esko. On-line construction of suffix trees. 1995. Algorithmica 14:249-60. http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf

[Gusfield1997]

Gusfield, Dan. Algorithms on strings, trees, and sequences. 1997. Cambridge University Press.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

suffix-tree-0.0.7.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

suffix_tree-0.0.7-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file suffix-tree-0.0.7.tar.gz.

File metadata

  • Download URL: suffix-tree-0.0.7.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for suffix-tree-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e008ca695f77b19d46471021ce691d9291e7b54b9e9fd719c48bf16a5246d8c4
MD5 a8db33df8ccc355d1dbc007d7a1b5bd4
BLAKE2b-256 eef2991ebeb87c5d3dc3eb59475d901f5e6cca13f7e7ba84c799936d99aa8c9f

See more details on using hashes here.

File details

Details for the file suffix_tree-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: suffix_tree-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for suffix_tree-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8911e6fdf611ffe23ebc1dfd66d61378b16b2167b05695af85ea91b2984e15fc
MD5 86d0f30441d39691a89275313b5175e8
BLAKE2b-256 08a32220baccb9ca9de016c174c8981bcbf9fcc328ddb2b07ee5218fe654df7d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page