I am looking for an efficient algorithm to find structures that are both recursive and hierarchical from a sequence. I did come across the sequitur algorithm but it only returns hierarchical structures.
Consider the following sequence as an example: abcbcabc
What sequitur returns:
0 -> 1 2 1
1 -> a 2
2 -> b c
Required output:
0 -> 1 1
1 -> a 2
2 -> b c | b c 2