bos / suffixtree

An efficient, lazy suffix tree implementation
http://hackage.haskell.org/package/suffixtree
Other
13 stars 4 forks source link

construct "BANANA" returns an incorrect result #4

Open GregorySchwartz opened 8 years ago

GregorySchwartz commented 8 years ago

The result of construct "BANANA" returns a different result than the classic example, as shown in https://upload.wikimedia.org/wikipedia/commons/d/d2/Suffix_tree_BANANA.svg on Wikipedia. Is this expected behavior? How would this differ from the classical suffix tree?

GregorySchwartz commented 8 years ago

Actually, I half take it back. construct "BANANA$" does in fact work, but shouldn't the terminator always be taken into account?

srhb commented 8 years ago

I think that construct, given a non-unique terminating character, simply ends up constructing the implicit suffix tree.

xogcox commented 3 years ago

I think that construct, given a non-unique terminating character, simply ends up constructing the implicit suffix tree.

Yes, the example in examples/UniqueMatch.hs suggests that users are expected to add a terminating character. It would probably be a good idea to either fix this so that the terminating character is added automatically, or document that it is needed.