1.1 --- a/test/all_pairs_shortest_path_test.cc Fri Oct 13 15:10:50 2006 +0000
1.2 +++ b/test/all_pairs_shortest_path_test.cc Sat Oct 14 15:26:05 2006 +0000
1.3 @@ -36,19 +36,18 @@
1.4 using namespace std;
1.5
1.6 int main(int argc, const char *argv[]) {
1.7 - srand(time(0));
1.8 typedef SmartGraph Graph;
1.9 typedef Graph::Node Node;
1.10 typedef Graph::Edge Edge;
1.11 typedef Graph::NodeIt NodeIt;
1.12 typedef Graph::EdgeIt EdgeIt;
1.13
1.14 - typedef Graph::EdgeMap<double> LengthMap;
1.15 - typedef Graph::NodeMap<double> DistMap;
1.16 + typedef Graph::EdgeMap<int> LengthMap;
1.17 + typedef Graph::NodeMap<int> DistMap;
1.18
1.19 const int n = argc > 1 ? atoi(argv[1]) : 20;
1.20 const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
1.21 - const double m = argc > 3 ? (double)atoi(argv[3]) : 100.0;
1.22 + const int m = argc > 3 ? atoi(argv[3]) : 100;
1.23
1.24 Graph graph;
1.25 LengthMap length(graph);
1.26 @@ -58,15 +57,14 @@
1.27 for (int i = 0; i < n; ++i) {
1.28 Node node = graph.addNode();
1.29 nodes.push_back(node);
1.30 - shift[node] = m * (double)rand() / (RAND_MAX + 1.0);
1.31 + shift[node] = rnd[m];
1.32 }
1.33
1.34 for (int i = 0; i < e; ++i) {
1.35 - int s = (int)(n * (double)rand() / (RAND_MAX + 1.0));
1.36 - int t = (int)(n * (double)rand() / (RAND_MAX + 1.0));
1.37 - double c = m * (double)rand() / (RAND_MAX + 1.0);
1.38 + int s = rnd[n];
1.39 + int t = rnd[n];
1.40 Edge edge = graph.addEdge(nodes[s], nodes[t]);
1.41 - length[edge] = c - shift[nodes[s]] + shift[nodes[t]];
1.42 + length[edge] = rnd[m] - shift[nodes[s]] + shift[nodes[t]];
1.43 }
1.44
1.45 Johnson<Graph, LengthMap> johnson(graph, length);
1.46 @@ -76,8 +74,8 @@
1.47 cout << "Johnson: " << timer << endl;
1.48 }
1.49
1.50 - typedef FibHeap<Node, double, Graph::NodeMap<int> > DoubleFibHeap;
1.51 - Johnson<Graph, LengthMap>::DefStandardHeap<DoubleFibHeap>
1.52 + typedef FibHeap<Node, int, Graph::NodeMap<int> > IntFibHeap;
1.53 + Johnson<Graph, LengthMap>::DefStandardHeap<IntFibHeap>
1.54 ::Create fibJohnson(graph, length);
1.55 {
1.56 Timer timer;