PGROUTING  2.6
Pgr_ksp< G >::compPaths Class Reference

Public Member Functions

bool operator() (const Path &p1, const Path &p2) const

Detailed Description

template<class G> class Pgr_ksp< G >::compPaths

Definition at line 52 of file pgr_ksp.hpp.

Member Function Documentation

template<class G>
 bool Pgr_ksp< G >::compPaths::operator() ( const Path & p1, const Path & p2 ) const
inline

Definition at line 54 of file pgr_ksp.hpp.

54  {
55  /*
56  * less cost is best
57  */
58  if (p1.tot_cost() > p2.tot_cost())
59  return false;
60  if (p1.tot_cost() < p2.tot_cost())
61  return true;
62
63  pgassert(p1.tot_cost() == p2.tot_cost());
64
65  // paths costs are equal now check by length
66  if (p1.size() > p2.size())
67  return false;
68  if (p1.size() < p2.size())
69  return true;
70
71  pgassert(p1.tot_cost() == p2.tot_cost());
72  pgassert(p1.size() == p2.size());
73
74  // paths weights & lengths are equal now check by node ID
75  unsigned int i;
76  for (i = 0; i < p1.size(); i++) {
77  if (p1[i].node > p2[i].node)
78  return false;
79  if (p1[i].node < p2[i].node)
80  return true;
81  }
82
83  pgassert(p1.tot_cost() == p2.tot_cost());
84  pgassert(p1.size() == p2.size());
85 #ifdef NDEBUG
86  for (i = 0; i < p1.size(); i++) {
87  pgassert(p1[i].node == p2[i].node);
88  }
89 #endif
90
91  // we got here and everything is equal
92  return false;
93  }
double tot_cost() const
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:81
size_t size() const

Here is the call graph for this function:

The documentation for this class was generated from the following file:
• /home/vicky/pgrouting/pgrouting/pgrouting/include/yen/pgr_ksp.hpp