Changeset 2242:16523135943d in lemon0.x for test/all_pairs_shortest_path_test.cc
 Timestamp:
 10/14/06 17:26:05 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2991
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/all_pairs_shortest_path_test.cc
r1956 r2242 37 37 38 38 int main(int argc, const char *argv[]) { 39 srand(time(0));40 39 typedef SmartGraph Graph; 41 40 typedef Graph::Node Node; … … 44 43 typedef Graph::EdgeIt EdgeIt; 45 44 46 typedef Graph::EdgeMap< double> LengthMap;47 typedef Graph::NodeMap< double> DistMap;45 typedef Graph::EdgeMap<int> LengthMap; 46 typedef Graph::NodeMap<int> DistMap; 48 47 49 48 const int n = argc > 1 ? atoi(argv[1]) : 20; 50 49 const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n)); 51 const double m = argc > 3 ? (double)atoi(argv[3]) : 100.0;50 const int m = argc > 3 ? atoi(argv[3]) : 100; 52 51 53 52 Graph graph; … … 59 58 Node node = graph.addNode(); 60 59 nodes.push_back(node); 61 shift[node] = m * (double)rand() / (RAND_MAX + 1.0);60 shift[node] = rnd[m]; 62 61 } 63 62 64 63 for (int i = 0; i < e; ++i) { 65 int s = (int)(n * (double)rand() / (RAND_MAX + 1.0)); 66 int t = (int)(n * (double)rand() / (RAND_MAX + 1.0)); 67 double c = m * (double)rand() / (RAND_MAX + 1.0); 64 int s = rnd[n]; 65 int t = rnd[n]; 68 66 Edge edge = graph.addEdge(nodes[s], nodes[t]); 69 length[edge] = c shift[nodes[s]] + shift[nodes[t]];67 length[edge] = rnd[m]  shift[nodes[s]] + shift[nodes[t]]; 70 68 } 71 69 … … 77 75 } 78 76 79 typedef FibHeap<Node, double, Graph::NodeMap<int> > DoubleFibHeap;80 Johnson<Graph, LengthMap>::DefStandardHeap< DoubleFibHeap>77 typedef FibHeap<Node, int, Graph::NodeMap<int> > IntFibHeap; 78 Johnson<Graph, LengthMap>::DefStandardHeap<IntFibHeap> 81 79 ::Create fibJohnson(graph, length); 82 80 {
Note: See TracChangeset
for help on using the changeset viewer.