lemon/dijkstra.h
changeset 479 55111a054b2e
parent 313 64f8f7cc6168
child 408 69f33ef03334
equal deleted inserted replaced
19:8de33c082451 20:90e56769e5c9
    45       return static_cast<Value>(0);
    45       return static_cast<Value>(0);
    46     }
    46     }
    47     /// \brief Gives back the sum of the given two elements.
    47     /// \brief Gives back the sum of the given two elements.
    48     static Value plus(const Value& left, const Value& right) {
    48     static Value plus(const Value& left, const Value& right) {
    49       return left + right;
    49       return left + right;
    50     }
       
    51     /// \brief Gives back true only if the first value is less than the second.
       
    52     static bool less(const Value& left, const Value& right) {
       
    53       return left < right;
       
    54     }
       
    55   };
       
    56 
       
    57   /// \brief Widest path operation traits for the Dijkstra algorithm class.
       
    58   ///
       
    59   /// This operation traits class defines all computational operations and
       
    60   /// constants which are used in the Dijkstra algorithm for widest path
       
    61   /// computation.
       
    62   ///
       
    63   /// \see DijkstraDefaultOperationTraits
       
    64   template <typename Value>
       
    65   struct DijkstraWidestPathOperationTraits {
       
    66     /// \brief Gives back the maximum value of the type.
       
    67     static Value zero() {
       
    68       return std::numeric_limits<Value>::max();
       
    69     }
       
    70     /// \brief Gives back the minimum of the given two elements.
       
    71     static Value plus(const Value& left, const Value& right) {
       
    72       return std::min(left, right);
       
    73     }
    50     }
    74     /// \brief Gives back true only if the first value is less than the second.
    51     /// \brief Gives back true only if the first value is less than the second.
    75     static bool less(const Value& left, const Value& right) {
    52     static bool less(const Value& left, const Value& right) {
    76       return left < right;
    53       return left < right;
    77     }
    54     }