How to Multiply Dynamic Programming Algorithms

  • Christian Höner zu Siederdissen
  • Ivo L. Hofacker
  • Peter F. Stadler
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8213)


We develop a theory of algebraic operations over linear grammars that makes it possible to combine simple “atomic” grammars operating on single sequences into complex, multi-dimensional grammars. We demonstrate the utility of this framework by constructing the search spaces of complex alignment problems on multiple input sequences explicitly as algebraic expressions of very simple 1-dimensional grammars. The compiler accompanying our theory makes it easy to experiment with the combination of multiple grammars and different operations. Composite grammars can be written out in \({\hbox{\LaTeX}}\) for documentation and as a guide to implementation of dynamic programming algorithms. An embedding in Haskell as a domain-specific language makes the theory directly accessible to writing and using grammar products without the detour of an external compiler.


linear grammar context free grammar product structure multiple alignment Haskell 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Lipman, D.J., Altschul, S.F., Kececioglu, J.D.: A tool for multiple sequence alignment. Proc. Natl. Acad. Sci. USA 86(12), 4412–4415 (1989)CrossRefGoogle Scholar
  2. 2.
    Giegerich, R., Meyer, C.: Algebraic Dynamic Programming. In: Kirchner, H., Ringeissen, C. (eds.) AMAST 2002. LNCS, vol. 2422, pp. 349–364. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  3. 3.
    Giegerich, R., Meyer, C., Steffen, P.: A Discipline of Dynamic Programming over Sequence Data. Science of Computer Programming 51(3), 215–263 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Gotoh, O.: An improved algorithm for matching biological sequences. J. Mol. Biol. 162, 705–708 (1982)CrossRefGoogle Scholar
  5. 5.
    Gotoh, O.: Alignment of three biological sequences with an efficient traceback procedure. J. Theor. Biol. 121, 327–337 (1986)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Dewey, T.G.: A sequence alignment algorithm with an arbitrary gap penalty function. J. Comp. Biol. 8, 177–190 (2001)CrossRefGoogle Scholar
  7. 7.
    Konagurthu, A.S., Whisstock, J., Stuckey, P.J.: Progressive multiple alignment using sequence triplet optimization and three-residue exchange costs. J. Bioinf. and Comp. Biol. 2, 719–745 (2004)CrossRefGoogle Scholar
  8. 8.
    Kruspe, M., Stadler, P.F.: Progressive multiple sequence alignments from triplets. BMC Bioinformatics 8, 254 (2007)CrossRefGoogle Scholar
  9. 9.
    Steiner, L., Stadler, P.F., Cysouw, M.: A pipeline for computational historical linguistics. Language Dynamics & Change 1, 89–127 (2011)CrossRefGoogle Scholar
  10. 10.
    Needleman, S.B., Wunsch, C.D.: A General Method Applicable to the Search for Similarities in the Amino Acid Sequence of Two Proteins. Journal of Molecular Biology 48(3), 443–453 (1970)CrossRefGoogle Scholar
  11. 11.
    Sankoff, D.: Simultaneous solution of the RNA folding, alignment and protosequence problems. SIAM Journal on Applied Mathematics, 810–825 (1985)Google Scholar
  12. 12.
    The GHC Team: The Glasgow Haskell Compiler (GHC) (1989–2013),
  13. 13.
    Sheard, T., Jones, S.P.: Template Meta-programming for Haskell. In: Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell, pp. 1–16. ACM (2002)Google Scholar
  14. 14.
    Coutts, D., Leshchinskiy, R., Stewart, D.: Stream Fusion: From Lists to Streams to Nothing at All. In: Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP 2007, pp. 315–326. ACM (2007)Google Scholar
  15. 15.
    Höner zu Siederdissen, C.: Sneaking around concatMap: efficient combinators for dynamic programming. In: Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP 2012, pp. 215–226. ACM (2012)Google Scholar
  16. 16.
    Mainland, G., Leshchinskiy, R., Jones, S.P., Marlow, S.: Exploiting vector instructions with generalized stream fusion. In: Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (2013)Google Scholar
  17. 17.
    Keller, G., Chakravarty, M.M., Leshchinskiy, R., Peyton Jones, S., Lippmeier, B.: Regular, Shape-polymorphic, Parallel Arrays in Haskell. In: Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP 2010, pp. 261–272. ACM (2010)Google Scholar
  18. 18.
    Steffen, P., Giegerich, R.: Versatile and declarative dynamic programming using pair algebras. BMC Bioinformatics 6(1), 224 (2005)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2013

Authors and Affiliations

  • Christian Höner zu Siederdissen
    • 1
  • Ivo L. Hofacker
    • 1
    • 2
    • 3
  • Peter F. Stadler
    • 4
    • 1
    • 3
    • 5
    • 6
    • 7
  1. 1.Dept. Theoretical ChemistryUniv. ViennaWienAustria
  2. 2.Bioinformatics and Computational Biology Research GroupUniversity of ViennaViennaAustria
  3. 3.RTHUniv. CopenhagenDenmark
  4. 4.Dept. Computer Science, and Interdisciplinary Center for BioinformaticsUniv. LeipzigLeipzigGermany
  5. 5.MPI Mathematics in the SciencesLeipzigGermany
  6. 6.FHI Cell Therapy and ImmunologyLeipzigGermany
  7. 7.Santa Fe InstituteSanta FeUSA

Personalised recommendations