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