8

Is there a nice implementation of suffix trees in JavaScript? Something that will take a string (and a separator) and make the appropriate suffix tree?

silverasm
  • 501
  • 5
  • 10

4 Answers4

5

Here's another implementation I wrote:

https://github.com/eikes/suffixtree/blob/master/js/suffixtree.js

eikes
  • 4,811
  • 2
  • 31
  • 31
2

Probably the most know implementation: http://felix-halim.net/pg/suffix-tree/index.php. But you want to search for an alternative at google site:www.cut-the-knot.org suffix-tree, too. You want too look for Matt Mahoney tutorial about the suffix-tree, too. The best tutorial on the net from a compression expert with source code in c.

Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Thanks! It's quite easy to understand what it's doing and modify it for my purposes. – silverasm Apr 21 '11 at 15:20
  • More specifically - Is there an easy way to check whether or not a substring exists in the tree? I went over the code and couldn't found one. Thanks – Nativ Feb 01 '17 at 20:12
  • @Nativ:Do u mean aho-corasick? I tried a little:https://phpahocorasick.codeplex.com/! – Micromega Feb 01 '17 at 20:50
1

find another implementation (ukkonen's) here: http://code.google.com/p/text-indexing/ ; suffixtree.JS is provided along with a HTML visualization

cos
  • 97
  • 1
0

Here is a live website and open source project which developed that.

live version: https://zamgo.github.io/suffix-tree/website/visualizer/

source code: https://github.com/ZaMgo/suffix-tree