1 // 2 // Path.cpp 3 // Cycle_Basis_PF 4 // 5 // Created by Hassan on 17/06/2014. 6 7 // 8 9 #include <gravity/Path.h> 10 #include <fstream> 11 12 13 /* @brief Returns true if the pair (n1,n2) is a source-destination pair for this path */ source_dest(Node * n1,Node * n2)14bool Path::source_dest(Node* n1, Node* n2){ 15 if(nodes.front()->_id==n1->_id && nodes.back()->_id==n2->_id) 16 return true; 17 18 if(nodes.front()->_id==n2->_id && nodes.back()->_id==n1->_id) 19 return true; 20 return false; 21 } 22 23 /* Returns the length of the path */ length()24int Path::length(){ 25 return (int)nodes.size(); 26 } 27 28 /* Returns true if the path is a cycle */ cycle()29bool Path::cycle(){ 30 return (nodes.front()==nodes.back()); 31 } 32 33