Rev | Line | |
---|

[568] | 1 | #include <test_tools.h> |
---|

| 2 | #include <hugo/smart_graph.h> |
---|

| 3 | #include <hugo/dijkstra.h> |
---|

| 4 | |
---|

| 5 | using namespace hugo; |
---|

| 6 | |
---|

| 7 | const int PET_SIZE =5; |
---|

| 8 | |
---|

| 9 | int main() |
---|

| 10 | { |
---|

| 11 | |
---|

| 12 | typedef SmartGraph Graph; |
---|

| 13 | |
---|

| 14 | typedef Graph::Edge Edge; |
---|

| 15 | typedef Graph::Node Node; |
---|

| 16 | typedef Graph::EdgeIt EdgeIt; |
---|

| 17 | typedef Graph::NodeIt NodeIt; |
---|

| 18 | typedef Graph::EdgeMap<int> LengthMap; |
---|

| 19 | |
---|

| 20 | Graph G; |
---|

| 21 | Node s, t; |
---|

| 22 | LengthMap cap(G); |
---|

| 23 | |
---|

| 24 | PetStruct<Graph> ps = addPetersen(G,PET_SIZE); |
---|

| 25 | |
---|

| 26 | for(int i=0;i<PET_SIZE;i++) { |
---|

| 27 | cap[ps.outcir[i]]=4; |
---|

| 28 | cap[ps.incir[i]]=1; |
---|

| 29 | cap[ps.chords[i]]=10; |
---|

| 30 | } |
---|

| 31 | s=ps.outer[0]; |
---|

| 32 | t=ps.inner[1]; |
---|

| 33 | |
---|

| 34 | Dijkstra<Graph, LengthMap> |
---|

| 35 | dijkstra_test(G, cap); |
---|

| 36 | dijkstra_test.run(s); |
---|

| 37 | |
---|

| 38 | check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path."); |
---|

| 39 | |
---|

| 40 | } |
---|

| 41 | |
---|

**Note:** See

TracBrowser
for help on using the repository browser.