1 #include <iostream>
2 #include <seqan/graph_algorithms.h>
3
4 using namespace seqan;
5
main()6 int main()
7 {
8 // Create a sequence of integers.
9 String<unsigned> seq;
10 appendValue(seq, 5);
11 appendValue(seq, 3);
12 appendValue(seq, 4);
13 appendValue(seq, 9);
14 appendValue(seq, 6);
15 appendValue(seq, 2);
16 appendValue(seq, 1);
17 appendValue(seq, 8);
18 appendValue(seq, 7);
19 appendValue(seq, 10);
20
21 // Compute the longest increasing subsequence.
22 typedef Position<String<unsigned> >::Type TPosition;
23 String<TPosition> pos;
24 longestIncreasingSubsequence(seq, pos);
25
26 // Print the result to stdout.
27 for (unsigned i = 0; i < length(seq); ++i)
28 std::cout << seq[i] << ',';
29
30 std::cout << "\n"
31 << "Lis: \n";
32 for (int i = length(pos) - 1; i >= 0; --i)
33 std::cout << seq[pos[i]] << ',';
34 std::cout << "\n";
35
36 return 0;
37 }
38