smabbasht / Eertree-Visualizer

Visualizer for the Palindromic Data Structure - eertree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Palindromic Tree (eertree)

Palindromic Trees (also know as eertree) are efficient data structures which can be used to store all the sub-palindromes in a string in just $O(nlog(\Sigma) ))$ where:

  • $n:$ Size of the input string.
  • $\Sigma :$ Size of the Alphabet
    In English, the Size of the alphabet is 26 which is $O(1)$ so in that case the complexity becomes $O(n)$

Applications

A Palindromic Tree can be used for many problems regarding the palindromes such as:

  • Finding the sub-palindromes inside a string
  • Finding the longest palindrome inside the string
  • Finding all unique palindromes
    For more information regarding the algorithm of constructing eertree, refer to this link

Our Application

Our Project aimed at visualizing the construction of the palindromic tree for any given input string. It is a step-by-step colored visualization which insert each nodes and shows all steps by coloring.

How to Operate

The file eertree.py handles all the eertree's opeartions and also contains class of the nodes contained in the eertree. Running the file Display.py will open the GUI. The pre-requisites for running the file is that you should have pygame and the pygame_menu modules installed. With that said, follow the following steps for visualization:

  • Type the word that you want to enter. The word would be shown on the GUI. Once you are done entering the string, press Enter.
  • From here with every press of space bar key, we increment a step in constructing the Palindromic Tree.
  • The red node marks where we stand at and the pink node marks where the traversal begins.
  • Once the string is fully processed, the whole palindromic tree is displayed on the GUI
  • The Green edges are the Suffix Links and the white edges are the labelled edges
  • To scroll, you can use the left, right, down and up keys to move the tree.
  • Pressing the escape key at any point will close the application. The application can also be closed by pressing the cross on the top-right.

References

About

Visualizer for the Palindromic Data Structure - eertree


Languages

Language:Python 100.0%