Skip to content

Session: Algorithms Library

rrahn edited this page Mar 6, 2017 · 3 revisions

One of the strengths of the STL is the generic algorithm library. It provides many algorithms that work generically on a set of iterators and thus for all data structures that are enumerable. Further, it can choose optimised specialisations depending on iterator categories, for example to do quick sort for random access iterators. This library design is also partially realised for SeqAn and should be extended in the future. Also, whenever possible use these algorithms, as improvements such as parallelisation are than easily ported to all using code paths. Moreover in combination with lambda functions, these functions can be easily customised by user defined predicate or binary overloads.

Here is the documentation to the algorithms library: http://en.cppreference.com/w/cpp/algorithm. Please also look at the pre-implemented function objects: http://en.cppreference.com/w/cpp/header/functional

In the following we will shortly cover the different algorithm categories:

  • non-modifying algorithms: Algorithms that retrieve some information from the container without changing the state of the data structures.
  • modifying algorithms: Such as generators, transformations and other operations, that modify the container.
  • partitioning algorithms: Assembles elements in the container given some condition.
  • sorting algorithms: Different sorting algorithms for the container.
  • binary search algorithms: searches in the sorted sets with binary search
  • misc: Furthermore there are algorithms on sets and heaps as well as numeric algorithms.

One feature added since C++17 is, that many algorithms got parallelised. The parallelisation mode can be activated through execution policies. This is very cool, as at any time parts of the code can be easily parallelised via setting the proper execution policy. This concept will also be added to the SeqAn core algorithms such as align and find.

Here are the slides

Clone this wiki locally