Monday, June 8, 2009

Suffix Trees: Java Applet Sources

Suffix Trees Java Applet is based on JFC/Swing and Applets.

Applet main classes:
  • STApplet - main applet class;
  • STControlPanel - control panel ;
  • STDrawPanel - draw panel.
Applet main classes diagram:

GUI classes:
  • GUIObject - base class;
  • GUIObserver - observer interface;
  • GUINode - suffix tree node;
  • GUIEdge - suffix tree edge;
  • GUILabel - suffix label, linked to edge;
  • GUILink - suffix link;
  • ArrowHead - helper arrow shape.
GUI classes diagram:

Download Suffix Trees Java Applet Sources

See also: my other Suffix Trees posts


Fahim said...

Your code for the suffix tree has been a great help for me. I understand that the Nelson's original C++ code requires that the last character of the input string must be unique.

It seems to me, that your implementation don't have such requirement. But I find WRONG OUTPUT for the input string "banana".

Any suggestion, please?

Illya Havsiyevych said...

The algorithm itself requires to have the last character of the input string to be unique. It comes from SuffixTree structure. If we have no such character in some cases it is not possible to find right edge.

In some implementations some rarely used character automatically added to the input string.

My implementation requires that this character is added to the input string by a user / developer.
For example, add '$' to the 'banana' to have 'banana$'.