Line data Source code
1 : #include "Alg/ShortestPath/ShortestPathOneOne.hpp" 2 : 3 : #include <list> 4 : 5 : using namespace std; 6 : using namespace Alg; 7 : using namespace Alg::ShortestPath; 8 : 9 93778 : ShortestPathOneOne::~ShortestPathOneOne() {} 10 : 11 114545 : Graph::Path ShortestPathOneOne::getPath(Graph::Node d) const { 12 114545 : if(isStart(d)) return Graph::Path(); 13 : 14 229090 : list<Graph::Edge> res; 15 : 16 114545 : Graph::Edge e = getPrev(d); 17 : 18 114545 : if(e.u == Graph::NODE_INVALID) return Graph::Path({Graph::EDGE_INVALID}); 19 : 20 507381 : while(!isStart(e.u)) { 21 392836 : res.push_front(e); 22 392836 : e = getPrev(e.u); 23 : } 24 114545 : res.push_front(e); 25 114545 : return Graph::Path(res.begin(), res.end()); 26 : }