1.1 --- a/src/work/athos/minlengthpaths.h Mon May 03 11:43:27 2004 +0000
1.2 +++ b/src/work/athos/minlengthpaths.h Mon May 03 14:42:40 2004 +0000
1.3 @@ -22,7 +22,7 @@
1.4 /// of minimal total length
1.5 ///
1.6 /// The class \ref hugo::MinLengthPaths "MinLengthPaths" implements
1.7 - /// an algorithm which finds k edge-disjoint paths
1.8 + /// an algorithm for finding k edge-disjoint paths
1.9 /// from a given source node to a given target node in an
1.10 /// edge-weighted directed graph having minimal total weigth (length).
1.11 ///
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/work/athos/minlengthpaths_test.cc Mon May 03 14:42:40 2004 +0000
2.3 @@ -0,0 +1,128 @@
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.cc Mon May 03 11:43:27 2004 +0000
3.2 +++ b/src/work/athos/xy/xy.cc Mon May 03 14:42:40 2004 +0000
3.3 @@ -1,7 +1,10 @@
3.4 #include <xy.h>
3.5 #include <iostream>
3.6 +#include <vector>
3.7 using namespace std;
3.8 using namespace hugo;
3.9 +
3.10 +
3.11 int main()
3.12 {
3.13
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/work/athos/xy/xy_test.cc Mon May 03 14:42:40 2004 +0000
4.3 @@ -0,0 +1,54 @@
4.4 +#include <xy.h>
4.5 +#include <iostream>
4.6 +using namespace std;
4.7 +using namespace hugo;
4.8 +
4.9 +bool passed = true;
4.10 +
4.11 +void check(bool rc) {
4.12 + passed = passed && rc;
4.13 + if(!rc) {
4.14 + cout << "Test failed!" << endl;
4.15 + }
4.16 +}
4.17 +
4.18 +
4.19 +
4.20 +int main()
4.21 +{
4.22 +
4.23 +
4.24 +
4.25 + typedef xy<int> XY;
4.26 +
4.27 + XY seged;
4.28 + XY a(1,2);
4.29 + XY b(3,4);
4.30 +
4.31 + seged = a+b;
4.32 + check(seged.x==4 && seged.y==6);
4.33 +
4.34 + seged = a-b;
4.35 + check(seged.x==-1 && seged.y==-1);
4.36 +
4.37 + check(a.normSquare()==5);
4.38 + check(a*b==11);
4.39 +
4.40 + int l=2;
4.41 + seged = a*l;
4.42 + check(seged.x==2 && seged.y==4);
4.43 +
4.44 + seged = b/l;
4.45 + check(seged.x==1 && seged.y==2);
4.46 +
4.47 + typedef BoundingBox<int> BB;
4.48 + BB doboz1;
4.49 + doboz1 += a;
4.50 + doboz1 += b;
4.51 +
4.52 + cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
4.53 + << endl;
4.54 +
4.55 + return passed ? 0 : 1;
4.56 +
4.57 +}