26 int n,
int lastAncestor,
27 std::list<int>& path) {
30 if(n == lastAncestor)
return true;
35 if(n == lastAncestor)
return true;
36 if(i++ > (
int)p.size()) {
37 LOG4CXX_INFO(KrisLibrary::logger(),
"GetAncestorPath(): Iterated more than the number of nodes, aborting\n");
39 for(std::list<int>::iterator it=path.begin();it!=path.end()&&i<20;it++,i++)
40 LOG4CXX_INFO(KrisLibrary::logger(),
""<<*it);
41 LOG4CXX_INFO(KrisLibrary::logger(),
"\n");
42 LOG4CXX_INFO(KrisLibrary::logger(),
"...\n");
43 std::list<int>::iterator it = path.end();
44 for(
int i=0;i<20;i++) it--;
45 while(it != path.end()) {
46 LOG4CXX_INFO(KrisLibrary::logger(),
""<<*it);
49 LOG4CXX_INFO(KrisLibrary::logger(),
"\n");
54 return (lastAncestor == -1);
61 int n,
int lastAncestor,
62 std::vector<int>& path) {
66 path.insert(path.end(),lpath.begin(),lpath.end());
75 Node n,std::list<Node>& path)
80 while(p.count(n) != 0) {
84 LOG4CXX_INFO(KrisLibrary::logger(),
"GetAncestorPath(): Iterated more than the number of nodes, aborting\n");
bool GetAncestorPath(const std::vector< int > &p, int n, int lastAncestor, std::list< int > &path)
Calculates a path of nodes from a list of parents.
Definition: graph/Path.h:25
A tree graph structure, represented directly at the node level.
Definition: Tree.h:25
The logging system used in KrisLibrary.
Namespace for all classes and functions in the Graph subdirectory.
Definition: ApproximateShortestPaths.h:7