Avoid ambiguity.
3 #include <lemon/list_graph.h>
4 #include <lemon/dijkstra.h>
5 //#include <lemon/graph_writer.h>
10 int main (int, char*[])
13 typedef ListGraph Graph;
14 typedef Graph::Node Node;
15 typedef Graph::Edge Edge;
16 typedef Graph::EdgeMap<int> LengthMap;
20 //An example from Ahuja's book
29 Edge s_v2=g.addEdge(s, v2);
30 Edge s_v3=g.addEdge(s, v3);
31 Edge v2_v4=g.addEdge(v2, v4);
32 Edge v2_v5=g.addEdge(v2, v5);
33 Edge v3_v5=g.addEdge(v3, v5);
34 Edge v4_t=g.addEdge(v4, t);
35 Edge v5_t=g.addEdge(v5, t);
47 std::cout << "This program is a simple demo of the LEMON Dijkstra class."<<std::endl;
48 std::cout << "We calculate the shortest path from node s to node t in a graph."<<std::endl;
49 std::cout <<std::endl;
52 std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."<<std::endl;
54 std::cout << "Dijkstra algorithm test..." << std::endl;
57 Dijkstra<Graph, LengthMap> dijkstra_test(g,len);
62 std::cout << "The distance of node t from node s: " << dijkstra_test.dist(t)<<std::endl;
64 std::cout << "The shortest path from s to t goes through the following nodes (the first one is t, the last one is s): "<<std::endl;
66 for (Node v=t;v != s; v=dijkstra_test.predNode(v)){
67 std::cout << g.id(v) << "<-";
69 std::cout << g.id(s) << std::endl;