Example Program
Shortest Path in DAGs
Computing single source shortest paths in a directed acyclic graph.
File "graph_algo_path_dag.cpp"
A tutorial about a shortest path search in a directed acyclic graph.
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 |
Graph creation: 10 directed edges (0,2), (0,1), ...
11 | |
12 | |
13 | |
14 | |
15 |
One external property map: Weight map
16 | |
17 | |
18 |
Out-parameters: Predecessor and distance map
19 | |
20 |
DAG-Shortest path from vertex 1
21 |
Console Output
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 |
See
SeqAn - Sequence Analysis Library - www.seqan.de