Peter is able to read xy vector from file.
3 #include <lemon/list_graph.h>
4 #include <lemon/dijkstra.h>
9 int main (int, char*[])
12 typedef ListGraph Graph;
13 typedef Graph::Node Node;
14 typedef Graph::Edge Edge;
15 typedef Graph::EdgeMap<int> LengthMap;
19 //An example from Ahuja's book
28 Edge s_v2=g.addEdge(s, v2);
29 Edge s_v3=g.addEdge(s, v3);
30 Edge v2_v4=g.addEdge(v2, v4);
31 Edge v2_v5=g.addEdge(v2, v5);
32 Edge v3_v5=g.addEdge(v3, v5);
33 Edge v4_t=g.addEdge(v4, t);
34 Edge v5_t=g.addEdge(v5, t);
46 std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."<<std::endl;
48 std::cout << "Dijkstra algorithm test..." << std::endl;
50 Dijkstra<Graph, LengthMap> dijkstra_test(g,len);
55 std::cout << "The distance of node t from node s: " << dijkstra_test.dist(t)<<std::endl;
57 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;
59 for (Node v=t;v != s; v=dijkstra_test.predNode(v)){
60 std::cout << g.id(v) << "<-";
62 std::cout << g.id(s) << std::endl;