This is needed for the demo.
authormarci
Thu, 16 Sep 2004 14:01:36 +0000
changeset 868805963ea8654
parent 867 f3cc65f9fb6b
child 869 c19cf2007a7a
This is needed for the demo.
src/demo/tight_edge_filter_map.h
src/work/marci/tight_edge_filter_map.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/demo/tight_edge_filter_map.h	Thu Sep 16 14:01:36 2004 +0000
     1.3 @@ -0,0 +1,46 @@
     1.4 +// -*- C++ -*-
     1.5 +#ifndef HUGO_TIGHT_EDGE_FILTER_MAP_H
     1.6 +#define HUGO_TIGHT_EDGE_FILTER_MAP_H
     1.7 +
     1.8 +// /// \file
     1.9 +// /// \brief Maximum flow algorithms.
    1.10 +// /// \ingroup galgs
    1.11 +
    1.12 +namespace hugo {
    1.13 +
    1.14 +  /// \brief A map for filtering the edge-set to those edges 
    1.15 +  /// which are tight w.r.t. some node_potential map and 
    1.16 +  /// edge_distance map.
    1.17 +  ///
    1.18 +  /// A node-map node_potential is said to be a potential w.r.t. 
    1.19 +  /// an edge-map edge_distance 
    1.20 +  /// if and only if for each edge e, node_potential[g.head(e)] 
    1.21 +  /// <= edge_distance[e]+node_potential[g.tail(e)] 
    1.22 +  /// (or the reverse inequality holds for each edge).
    1.23 +  /// An edge is said to be tight if this inequality holds with equality, 
    1.24 +  /// and the map returns true exactly for those edges.
    1.25 +  /// To avoid rounding errors, it is recommended to use this class with exact 
    1.26 +  /// types, e.g. with int.
    1.27 +  template<typename Graph, 
    1.28 +	   typename NodePotentialMap, typename EdgeDistanceMap>
    1.29 +  class TightEdgeFilterMap {
    1.30 +  protected:
    1.31 +    const Graph* g;
    1.32 +    NodePotentialMap* node_potential;
    1.33 +    EdgeDistanceMap* edge_distance;
    1.34 +  public:
    1.35 +    TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential, 
    1.36 +		       EdgeDistanceMap& _edge_distance) : 
    1.37 +      g(&_g), node_potential(&_node_potential), 
    1.38 +      edge_distance(&_edge_distance) { }
    1.39 +    bool operator[](const typename Graph::Edge& e) const {
    1.40 +      return ((*node_potential)[g->head(e)] == 
    1.41 +	      (*edge_distance)[e]+(*node_potential)[g->tail(e)]);
    1.42 +    }
    1.43 +  };
    1.44 +
    1.45 +} //namespace hugo
    1.46 +
    1.47 +#endif //HUGO_TIGHT_EDGE_FILTER_MAP_H
    1.48 +
    1.49 +
     2.1 --- a/src/work/marci/tight_edge_filter_map.h	Thu Sep 16 13:59:36 2004 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,46 +0,0 @@
     2.4 -// -*- C++ -*-
     2.5 -#ifndef HUGO_TIGHT_EDGE_FILTER_MAP_H
     2.6 -#define HUGO_TIGHT_EDGE_FILTER_MAP_H
     2.7 -
     2.8 -// /// \file
     2.9 -// /// \brief Maximum flow algorithms.
    2.10 -// /// \ingroup galgs
    2.11 -
    2.12 -namespace hugo {
    2.13 -
    2.14 -  /// \brief A map for filtering the edge-set to those edges 
    2.15 -  /// which are tight w.r.t. some node_potential map and 
    2.16 -  /// edge_distance map.
    2.17 -  ///
    2.18 -  /// A node-map node_potential is said to be a potential w.r.t. 
    2.19 -  /// an edge-map edge_distance 
    2.20 -  /// if and only if for each edge e, node_potential[g.head(e)] 
    2.21 -  /// <= edge_distance[e]+node_potential[g.tail(e)] 
    2.22 -  /// (or the reverse inequality holds for each edge).
    2.23 -  /// An edge is said to be tight if this inequality holds with equality, 
    2.24 -  /// and the map returns true exactly for those edges.
    2.25 -  /// To avoid rounding errors, it is recommended to use this class with exact 
    2.26 -  /// types, e.g. with int.
    2.27 -  template<typename Graph, 
    2.28 -	   typename NodePotentialMap, typename EdgeDistanceMap>
    2.29 -  class TightEdgeFilterMap {
    2.30 -  protected:
    2.31 -    const Graph* g;
    2.32 -    NodePotentialMap* node_potential;
    2.33 -    EdgeDistanceMap* edge_distance;
    2.34 -  public:
    2.35 -    TightEdgeFilterMap(Graph& _g, NodePotentialMap& _node_potential, 
    2.36 -		       EdgeDistanceMap& _edge_distance) : 
    2.37 -      g(&_g), node_potential(&_node_potential), 
    2.38 -      edge_distance(&_edge_distance) { }
    2.39 -    bool operator[](const typename Graph::Edge& e) const {
    2.40 -      return ((*node_potential)[g->head(e)] == 
    2.41 -	      (*edge_distance)[e]+(*node_potential)[g->tail(e)]);
    2.42 -    }
    2.43 -  };
    2.44 -
    2.45 -} //namespace hugo
    2.46 -
    2.47 -#endif //HUGO_TIGHT_EDGE_FILTER_MAP_H
    2.48 -
    2.49 -