1.1 --- a/src/work/athos/minlengthpaths.h Tue May 04 09:00:11 2004 +0000
1.2 +++ b/src/work/athos/minlengthpaths.h Tue May 04 09:03:00 2004 +0000
1.3 @@ -180,7 +180,7 @@
1.4
1.5 ///This function gives back the \c j-th path in argument p.
1.6 ///Assumes that \c run() has been run and nothing changed since then.
1.7 - /// \warning It is assumed that \c p is constructed to be a path of graph \c G.
1.8 + /// \warning It is assumed that \c p is constructed to be a path of graph \c G. If \c j is greater than the result of previous \c run, then the result here will be an empty path.
1.9 template<typename DirPath>
1.10 void getPath(DirPath& p, int j){
1.11 p.clear();
2.1 --- a/src/work/athos/minlengthpaths_test.cc Tue May 04 09:00:11 2004 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,128 +0,0 @@
2.4 -// -*- c++ -*-
2.5 -//#include <iostream>
2.6 -//#include <vector>
2.7 -//#include <string>
2.8 -
2.9 -#include <list_graph.h>
2.10 -#include <minlengthpaths.h>
2.11 -
2.12 -using namespace hugo;
2.13 -
2.14 -
2.15 -int main()
2.16 -{
2.17 -
2.18 -
2.19 - typedef ListGraph::Node Node;
2.20 - typedef ListGraph::Edge Edge;
2.21 -
2.22 - ListGraph graph;
2.23 -
2.24 - /*
2.25 - //Marci példája
2.26 -
2.27 -
2.28 - NodeIt s=graph.addNode();
2.29 - NodeIt v1=graph.addNode();
2.30 - NodeIt v2=graph.addNode();
2.31 - NodeIt v3=graph.addNode();
2.32 - NodeIt v4=graph.addNode();
2.33 - NodeIt t=graph.addNode();
2.34 -
2.35 -
2.36 - EdgeIt s_v1=graph.addEdge(s, v1);
2.37 - EdgeIt s_v2=graph.addEdge(s, v2);
2.38 - EdgeIt v1_v2=graph.addEdge(v1, v2);
2.39 - EdgeIt v2_v1=graph.addEdge(v2, v1);
2.40 - EdgeIt v1_v3=graph.addEdge(v1, v3);
2.41 - EdgeIt v3_v2=graph.addEdge(v3, v2);
2.42 - EdgeIt v2_v4=graph.addEdge(v2, v4);
2.43 - EdgeIt v4_v3=graph.addEdge(v4, v3);
2.44 - EdgeIt v3_t=graph.addEdge(v3, t);
2.45 - EdgeIt v4_t=graph.addEdge(v4, t);
2.46 -
2.47 - ListGraph::EdgeMap<int> length(graph);
2.48 -
2.49 - length.set(s_v1, 16);
2.50 - length.set(s_v2, 13);
2.51 - length.set(v1_v2, 10);
2.52 - length.set(v2_v1, 4);
2.53 - length.set(v1_v3, 12);
2.54 - length.set(v3_v2, 9);
2.55 - length.set(v2_v4, 14);
2.56 - length.set(v4_v3, 7);
2.57 - length.set(v3_t, 20);
2.58 - length.set(v4_t, 4);
2.59 - */
2.60 -
2.61 -
2.62 - //Ahuja könyv példája
2.63 -
2.64 - Node s=graph.addNode();
2.65 - Node v2=graph.addNode();
2.66 - Node v3=graph.addNode();
2.67 - Node v4=graph.addNode();
2.68 - Node v5=graph.addNode();
2.69 - Node t=graph.addNode();
2.70 -
2.71 - Edge s_v2=graph.addEdge(s, v2);
2.72 - Edge s_v3=graph.addEdge(s, v3);
2.73 - Edge v2_v4=graph.addEdge(v2, v4);
2.74 - Edge v2_v5=graph.addEdge(v2, v5);
2.75 - Edge v3_v5=graph.addEdge(v3, v5);
2.76 - Edge v4_t=graph.addEdge(v4, t);
2.77 - Edge v5_t=graph.addEdge(v5, t);
2.78 -
2.79 - //Kis modositas
2.80 - //edge_iterator v2_s=graph.add_edge(v2, s);
2.81 -
2.82 - ListGraph::EdgeMap<int> length(graph);
2.83 -
2.84 - length.set(s_v2, 10);
2.85 - length.set(s_v3, 10);
2.86 - length.set(v2_v4, 5);
2.87 - length.set(v2_v5, 8);
2.88 - length.set(v3_v5, 5);
2.89 - length.set(v4_t, 8);
2.90 - length.set(v5_t, 8);
2.91 -
2.92 - //Kis modositas
2.93 - //length.put(v2_s, 100);
2.94 -
2.95 -
2.96 -
2.97 -
2.98 - /*Egyszerű példa
2.99 - NodeIt s=flow_test.add_node();
2.100 - NodeIt v1=flow_test.add_node();
2.101 - NodeIt v2=flow_test.add_node();
2.102 - NodeIt t=flow_test.add_node();
2.103 -
2.104 - node_property_vector<list_graph, std::string> node_name(flow_test);
2.105 - node_name.put(s, "s");
2.106 - node_name.put(v1, "v1");
2.107 - node_name.put(v2, "v2");
2.108 - node_name.put(t, "t");
2.109 -
2.110 - edge_iterator s_v1=flow_test.add_edge(s, v1);
2.111 - edge_iterator v1_v2=flow_test.add_edge(v1, v2);
2.112 - edge_iterator v2_t=flow_test.add_edge(v2, t);
2.113 -
2.114 - edge_property_vector<list_graph, int> length(flow_test);
2.115 -
2.116 - length.put(s_v1, 16);
2.117 - length.put(v1_v2, 10);
2.118 - length.put(v2_t, 4);
2.119 - */
2.120 -
2.121 - std::cout << "Suurballe algorithm test..." << std::endl;
2.122 -
2.123 -
2.124 - int k=3;
2.125 - MinLengthPaths<ListGraph, ListGraph::EdgeMap<int> >
2.126 - surb_test(graph, length);
2.127 - std::cout << surb_test.run(s,t,k) << std::endl;
2.128 -
2.129 -
2.130 - return 0;
2.131 -}
3.1 --- a/src/work/athos/xy/xy_test.cc Tue May 04 09:00:11 2004 +0000
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,54 +0,0 @@
3.4 -#include <xy.h>
3.5 -#include <iostream>
3.6 -using namespace std;
3.7 -using namespace hugo;
3.8 -
3.9 -bool passed = true;
3.10 -
3.11 -void check(bool rc) {
3.12 - passed = passed && rc;
3.13 - if(!rc) {
3.14 - cout << "Test failed!" << endl;
3.15 - }
3.16 -}
3.17 -
3.18 -
3.19 -
3.20 -int main()
3.21 -{
3.22 -
3.23 -
3.24 -
3.25 - typedef xy<int> XY;
3.26 -
3.27 - XY seged;
3.28 - XY a(1,2);
3.29 - XY b(3,4);
3.30 -
3.31 - seged = a+b;
3.32 - check(seged.x==4 && seged.y==6);
3.33 -
3.34 - seged = a-b;
3.35 - check(seged.x==-1 && seged.y==-1);
3.36 -
3.37 - check(a.normSquare()==5);
3.38 - check(a*b==11);
3.39 -
3.40 - int l=2;
3.41 - seged = a*l;
3.42 - check(seged.x==2 && seged.y==4);
3.43 -
3.44 - seged = b/l;
3.45 - check(seged.x==1 && seged.y==2);
3.46 -
3.47 - typedef BoundingBox<int> BB;
3.48 - BB doboz1;
3.49 - doboz1 += a;
3.50 - doboz1 += b;
3.51 -
3.52 - cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
3.53 - << endl;
3.54 -
3.55 - return passed ? 0 : 1;
3.56 -
3.57 -}