I have a std::list graph edges and i want to sort the edges based on their destination outdegree and then their indegree. But i am getting getting exception of invalid operator < during my comparison function below is my code. My list contains the pointers to the edges and edges have destination nodes as their member.
bool compareEdges(const Edge *e1,const Edge *e2){
if(e1->destination->outdegree < e2->destination->outdegree){
return true;
}
else if(e1->destination->outdegree > e2->destination->outdegree){
return false;
}
else if(e1->destination->indegree > e2->destination->indegree){
return false;
}
return true;
}
And here is the call to the sort function.
currentNode->edgeList.sort(compareEdges);
Please help me in removing this exception.
Thanks
See Question&Answers more detail:os