mutux / ukkonen-s-suffix-tree-algorithm Goto Github PK
View Code? Open in Web Editor NEWUkkonen's suffix tree algorithm, a complete version implemented in Python
Home Page: http://mutux.com
License: MIT License
Ukkonen's suffix tree algorithm, a complete version implemented in Python
Home Page: http://mutux.com
License: MIT License
When a leaf node is split, the parentkey of existing node is not updated to point to internal node.
This needs to be added: bnode.setparentkey((newnode, chars[start + actlen]))
Here's a patch to add it:
suffixtree_setparentkey_on_split.patch
There is a copy of list in unfold function. It leads to O(len(remains))
time complexity for this operation. And due to being inside while remainder > 0
this gains O(n^2) time complexity for the whole implementation (e.g. for "aaaaab"
).
I tried to translate to Python 3 but the meaning of the double parentheses in the setoutedge
definition eludes me.
def setoutedge(self, key, (anode, label_start_index, label_end_index, bnode)):
I guessed it would mean
def setoutedge(self, key, anode=None, label_start_index=None, label_end_index=None, bnode=None):
but implementing this change just broke the code in new ways. Could you please explain what this definition means?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.