| 4 | namespace MTC { |
| 5 | namespace accessibility { |
| 6 | Graphalg::Graphalg( |
| 7 | int numnodes, vector< vector<long> > edges, vector<double> edgeweights, |
| 8 | bool twoway) { |
| 9 | this->numnodes = numnodes; |
| 10 | |
| 11 | int num = omp_get_max_threads(); |
| 12 | |
| 13 | FILE_LOG(logINFO) << "Generating contraction hierarchies with " |
| 14 | << num << " threads.\n"; |
| 15 | |
| 16 | ch = CH::ContractionHierarchies(num); |
| 17 | |
| 18 | vector<CH::Node> nv; |
| 19 | |
| 20 | for (int i = 0 ; i < numnodes ; i++) { |
| 21 | // CH allows you to pass in a node id, and an x and a y, and then |
| 22 | // never uses it - to be clear, we don't pass it in anymore |
| 23 | CH::Node n(i, 0, 0); |
| 24 | nv.push_back(n); |
| 25 | } |
| 26 | |
| 27 | FILE_LOG(logINFO) << "Setting CH node vector of size " |
| 28 | << nv.size() << "\n"; |
| 29 | |
| 30 | ch.SetNodeVector(nv); |
| 31 | |
| 32 | vector<CH::Edge> ev; |
| 33 | |
| 34 | for (int i = 0 ; i < edges.size() ; i++) { |
| 35 | CH::Edge e(edges[i][0], edges[i][1], i, |
| 36 | edgeweights[i]*DISTANCEMULTFACT, true, twoway); |
| 37 | ev.push_back(e); |
| 38 | } |
| 39 | |
| 40 | FILE_LOG(logINFO) << "Setting CH edge vector of size " |
| 41 | << ev.size() << "\n"; |
| 42 | |
| 43 | ch.SetEdgeVector(ev); |
| 44 | ch.RunPreprocessing(); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | std::vector<NodeID> Graphalg::Route(int src, int tgt, int threadNum) { |
nothing calls this directly
no test coverage detected