The backPtr_ of last node is pointing to itself at the time of generating trajectory. This is mostly happening due to the backptr__ is pointing at the back of openNodes and while exploring a node it is last element due to pop_heap. Any work around for this?

I have already tried to keep the openNodes as vector of Node objects rather than of pointers.

```
init_node.calculateF();
vector<Node*> openNodes;
openNodes.push_back(&init_node);
vector<vector<coord_t>> traj;
while(!openNodes.empty()){
pop_heap(openNodes.begin(), openNodes.end(), NodePtrCompareGtr());
Node* newNodePtr = openNodes.back();
Node newNode = *newNodePtr;
openNodes.pop_back();
traj = newNode.exploreNodes(openNodes, openSet, closedNodes, &newNode);
}
class Node
{
Node *backPtr_ = NULL;
public:
void setBackPtr(Node* nodeptr){
backPtr_ = nodeptr;
}
vector<vector<coord_t>> exploreNodes(vector<Node*> &openNodes){
newCoordList = generateCoords();
vector<Node*> newNodeList;
if(goal_reached(this)){
return generate_traj(this);
}
for(auto const& newCoords : newCoordsList){
Node *newNode = new Node(...);
newNodeList.push_back(newNode);
}
for(auto & i : newNodeList){
...
i->setBackPtr(this);
openNodes.push_back(i);
make_heap(openNodes.begin(), openNodes.end(), NodePtrCompareGtr());
...
}
}
```

I want to store the backPtr_ correctly to store the correct previous node.