tight_edge_filter_map.h

00001 /* -*- C++ -*-
00002  *
00003  * This file is a part of LEMON, a generic C++ optimization library
00004  *
00005  * Copyright (C) 2003-2006
00006  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
00007  * (Egervary Research Group on Combinatorial Optimization, EGRES).
00008  *
00009  * Permission to use, modify and distribute this software is granted
00010  * provided that this copyright notice appears in all copies. For
00011  * precise terms see the accompanying LICENSE file.
00012  *
00013  * This software is provided "AS IS" with no warranty of any kind,
00014  * express or implied, and with no claim as to its suitability for any
00015  * purpose.
00016  *
00017  */
00018 
00019 #ifndef LEMON_TIGHT_EDGE_FILTER_MAP_H
00020 #define LEMON_TIGHT_EDGE_FILTER_MAP_H
00021 
00022 #include <lemon/maps.h>
00023 
00024 // /// \file
00025 // /// \brief Maximum flow algorithms.
00026 // /// \ingroup galgs
00027 
00028 namespace lemon {
00029 
00049   template<typename Graph, 
00050            typename NodePotentialMap, typename EdgeDistanceMap>
00051   class TightEdgeFilterMap : public MapBase<typename Graph::Edge, bool> {
00052   protected:
00053     const Graph* g;
00054     NodePotentialMap* node_potential;
00055     EdgeDistanceMap* edge_distance;
00056   public:
00057     TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential, 
00058                        EdgeDistanceMap& _edge_distance) : 
00059       g(&_g), node_potential(&_node_potential), 
00060       edge_distance(&_edge_distance) { }
00061     bool operator[](const typename Graph::Edge& e) const {
00062       return ((*node_potential)[g->target(e)] == 
00063               (*edge_distance)[e]+(*node_potential)[g->source(e)]);
00064     }
00065   };
00066 
00067 } //namespace lemon
00068 
00069 #endif //LEMON_TIGHT_EDGE_FILTER_MAP_H

Generated on Fri Feb 3 18:35:22 2006 for LEMON by  doxygen 1.4.6