Ternary Directed Acyclic Word Graphs

  • Satoru Miyamoto
  • Shunsuke Inenaga
  • Masayuki Takeda
  • Ayumi Shinohara
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2759)


Given a set S of strings, a DFA accepting S offers a very time-efficient solution to the pattern matching problem over S. The key is how to implement such a DFA in the trade-off between time and space, and especially the choice of how to implement the transitions of each state is critical. Bentley and Sedgewick proposed an effective tree structure called ternary trees. The idea of ternary trees is to ‘implant’ the process of binary search for transitions into the structure of the trees themselves. This way the process of binary search becomes visible, and the implementation of the trees becomes quite easy. The directed acyclic word graph (DAWG) of a string w is the smallest DFA that accepts all suffixes of w, and requires only linear space. We apply the scheme of ternary trees to DAWGs, introducing a new data structure named ternary DAWGs (TDAWGs). We perform some experiments that show the efficiency of TDAWGs, compared to DAWGs in which transitions are implemented by tables and linked lists.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    G. M. Andelson-Velskii and E. M. Landis. An algorithm for the organisation of information. Soviet. Math., 3:1259–1262, 1962.Google Scholar
  2. [2]
    J. Bentley and B. Sedgewick. Ternary search trees. Dr. Dobb’s Journal, 1998.
  3. [3]
    J. Bentley and R. Sedgewick. Fast algorithms for sorting and searching strings. In Proc. 8th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’97), pages 360–369. ACM/SIAM, 1997.Google Scholar
  4. [4]
    A. Blumer, J. Blumer, D. Haussler, A. Ehrenfeucht, M. T. Chen, and J. Seiferas. The smallest automaton recognizing the subwords of a text. Theoretical Computer Science, 40:31–55, 1985.zbMATHCrossRefMathSciNetGoogle Scholar
  5. [5]
    A. Blumer, J. Blumer, D. Haussler, R. McConnell, and A. Ehrenfeucht. Complete inverted files for efficient text retrieval and analysis. J. ACM, 34(3):578–595, 1987.CrossRefMathSciNetGoogle Scholar
  6. [6]
    M. Crochemore. Transducers and repetitions. Theoretical Computer Science, 45:63–86, 1986.zbMATHCrossRefMathSciNetGoogle Scholar
  7. [7]
    M. Crochemore and W. Rytter. Text Algorithms. Oxford University Press, New York, 1994.zbMATHGoogle Scholar
  8. [8]
    M. Crochemore and W. Rytter. Jewels of Stringology. World Scientific, 2002.Google Scholar
  9. [9]
    M. Crochemore and R. Vérin. On compact directed acyclic word graphs. In Structures in Logic and Computer Science, volume 1261 of LNCS, pages 192–211. Springer-Verlag, 1997.Google Scholar
  10. [10]
    D. Gusfield. Algorithms on Strings, Trees, and Sequences. Cambridge University Press, New York, 1997.zbMATHGoogle Scholar
  11. [11]
    S. Inenaga, H. Hoshino, A. Shinohara, M. Takeda, S. Arikawa, G. Mauri, and G. Pavesi. On-line construction of compact directed acyclic word graphs. In A. Amir and G. M. Landau, editors, Proc. 12th Annual Symposium on Combinatorial Pattern Matching (CPM’01), volume 2089 of LNCS, pages 169–180. Springer-Verlag, 2001.Google Scholar
  12. [12]
    E. M. McCreight. A space-economical suffix tree construction algorithm. J. ACM, 23(2):262–272, 1976.zbMATHCrossRefMathSciNetGoogle Scholar
  13. [13]
    D. Revuz. Minimization of acyclic deterministic automata in linear time. Theoretical Computer Science, 92(1):181–189, 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  14. [14]
    E. Ukkonen. On-line construction of suffix trees. Algorithmica, 14(3):249–260, 1995.zbMATHCrossRefMathSciNetGoogle Scholar
  15. [15]
    E. Ukkonen and D. Wood. Approximate string matching with suffix automata. Algorithmica, 10(5):353–364, 1993.zbMATHCrossRefMathSciNetGoogle Scholar
  16. [16]
    P. Weiner. Linear pattern matching algorithms. In Proc. 14th Annual Symposium on Switching and Automata Theory, pages 1–11, 1973.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Satoru Miyamoto
    • 1
  • Shunsuke Inenaga
    • 1
    • 2
  • Masayuki Takeda
    • 1
    • 2
  • Ayumi Shinohara
    • 1
    • 2
  1. 1.Department of InformaticsKyushu University 33FukuokaJapan
  2. 2.PRESTOJapan Science and Technology Corporation (JST)Japan

Personalised recommendations