minor corrections
authormarci
Mon, 27 Sep 2004 18:11:27 +0000
changeset 9105a89cacf17f1
parent 909 6a22e0dfd453
child 911 89a4fbb99cad
minor corrections
src/hugo/graph_wrapper.h
src/hugo/min_cost_flow.h
src/hugo/tight_edge_filter_map.h
     1.1 --- a/src/hugo/graph_wrapper.h	Sun Sep 26 21:43:38 2004 +0000
     1.2 +++ b/src/hugo/graph_wrapper.h	Mon Sep 27 18:11:27 2004 +0000
     1.3 @@ -27,6 +27,7 @@
     1.4  
     1.5  #include <hugo/invalid.h>
     1.6  #include <hugo/maps.h>
     1.7 +#include <hugo/map_defines.h>
     1.8  #include <iostream>
     1.9  
    1.10  namespace hugo {
    1.11 @@ -314,7 +315,7 @@
    1.12    ///
    1.13    /// This wrapper shows a graph with filtered node-set and 
    1.14    /// edge-set. Given a bool-valued map on the node-set and one on 
    1.15 -  /// the edge-set of the graphs, the iterators shows only the objects 
    1.16 +  /// the edge-set of the graphs, the iterators show only the objects 
    1.17    /// having true value. 
    1.18    /// The quick brown fox iterators jump over 
    1.19    /// the lazy dog nodes or edges if their values for are false in the 
    1.20 @@ -577,15 +578,15 @@
    1.21  
    1.22    };
    1.23    
    1.24 -  /// \brief An undirected graph template.
    1.25 -  ///
    1.26 -  ///\warning Graph wrappers are in even more experimental state than the other
    1.27 -  ///parts of the lib. Use them at your own risk.
    1.28 -  ///
    1.29 -  /// An undirected graph template.
    1.30 -  /// This class works as an undirected graph and a directed graph of 
    1.31 -  /// class \c Graph is used for the physical storage.
    1.32 -  /// \ingroup graphs
    1.33 +//   /// \brief An undirected graph template.
    1.34 +//   ///
    1.35 +//   ///\warning Graph wrappers are in even more experimental state than the other
    1.36 +//   ///parts of the lib. Use them at your own risk.
    1.37 +//   ///
    1.38 +//   /// An undirected graph template.
    1.39 +//   /// This class works as an undirected graph and a directed graph of 
    1.40 +//   /// class \c Graph is used for the physical storage.
    1.41 +//   /// \ingroup graphs
    1.42    template<typename Graph>
    1.43    class UndirGraph : public UndirGraphWrapper<Graph> {
    1.44      typedef UndirGraphWrapper<Graph> Parent;
    1.45 @@ -608,7 +609,8 @@
    1.46    ///parts of the lib. Use them at you own risk.
    1.47    ///
    1.48    /// Suppose that for a directed graph $G=(V, A)$, 
    1.49 -  /// two predicates on the edge-set, $forward_filter$, and $backward_filter$ 
    1.50 +  /// two bool valued maps on the edge-set, 
    1.51 +  /// $forward_filter$, and $backward_filter$ 
    1.52    /// is given, and we are dealing with the directed graph
    1.53    /// a $G'=(V, \{uv : uv\in A \mbox{ and } forward_filter(uv) \mbox{ is true}\}+\{vu : uv\in A \mbox{ and } backward_filter(uv) \mbox{ is true}\})$. 
    1.54    /// The purpose of writing + instead of union is because parallel 
    1.55 @@ -621,14 +623,14 @@
    1.56    /// \c RevGraphWrapper is implemented in a different way. 
    1.57    /// But BidirGraphWrapper is obtained from 
    1.58    /// SubBidirGraphWrapper by considering everywhere true 
    1.59 -  /// predicates both forward_filter and backward_filter. 
    1.60 +  /// valued maps both for forward_filter and backward_filter. 
    1.61    /// Finally, one of the most important applications of SubBidirGraphWrapper 
    1.62    /// is ResGraphWrapper, which stands for the residual graph in directed 
    1.63    /// flow and circulation problems. 
    1.64    /// As wrappers usually, the SubBidirGraphWrapper implements the 
    1.65    /// above mentioned graph structure without its physical storage, 
    1.66    /// that is the whole stuff eats constant memory. 
    1.67 -  /// As the oppositely directed edges are logical different, 
    1.68 +  /// As the oppositely directed edges are logically different, 
    1.69    /// the maps are able to attach different values for them. 
    1.70    template<typename Graph, 
    1.71  	   typename ForwardFilterMap, typename BackwardFilterMap>
    1.72 @@ -670,7 +672,8 @@
    1.73  
    1.74      typedef typename Graph::Edge GraphEdge;
    1.75      /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from 
    1.76 -    /// Graph::Edge. It contains an extra bool flag which shows if the 
    1.77 +    /// Graph::Edge. It contains an extra bool flag which is true 
    1.78 +    /// if and only if the 
    1.79      /// edge is the backward version of the original edge.
    1.80      class Edge : public Graph::Edge {
    1.81        friend class SubBidirGraphWrapper<Graph, 
    1.82 @@ -1130,7 +1133,8 @@
    1.83  
    1.84      /// \brief Residual capacity map.
    1.85      ///
    1.86 -    /// In generic residual graphs the residual capacity can be obtained as a map. Not tested.
    1.87 +    /// In generic residual graphs the residual capacity can be obtained 
    1.88 +    /// as a map. 
    1.89      class ResCap {
    1.90      protected:
    1.91        const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>* res_graph;
     2.1 --- a/src/hugo/min_cost_flow.h	Sun Sep 26 21:43:38 2004 +0000
     2.2 +++ b/src/hugo/min_cost_flow.h	Mon Sep 27 18:11:27 2004 +0000
     2.3 @@ -71,26 +71,26 @@
     2.4      typedef typename Graph::template EdgeMap<int> EdgeIntMap;
     2.5  
     2.6  
     2.7 -    typedef ResGraphWrapper<const Graph,int,CapacityMap,EdgeIntMap> ResGraphType;
     2.8 -    typedef typename ResGraphType::Edge ResGraphEdge;
     2.9 +    typedef ResGraphWrapper<const Graph,int,CapacityMap,EdgeIntMap> ResGW;
    2.10 +    typedef typename ResGW::Edge ResGraphEdge;
    2.11  
    2.12      class ModLengthMap {   
    2.13        typedef typename Graph::template NodeMap<Length> NodeMap;
    2.14 -      const ResGraphType& G;
    2.15 +      const ResGW& G;
    2.16        const LengthMap &ol;
    2.17        const NodeMap &pot;
    2.18      public :
    2.19        typedef typename LengthMap::KeyType KeyType;
    2.20        typedef typename LengthMap::ValueType ValueType;
    2.21  	
    2.22 -      ValueType operator[](typename ResGraphType::Edge e) const {     
    2.23 +      ValueType operator[](typename ResGW::Edge e) const {     
    2.24  	if (G.forward(e))
    2.25  	  return  ol[e]-(pot[G.head(e)]-pot[G.tail(e)]);   
    2.26  	else
    2.27  	  return -ol[e]-(pot[G.head(e)]-pot[G.tail(e)]);   
    2.28        }     
    2.29  	
    2.30 -      ModLengthMap(const ResGraphType& _G,
    2.31 +      ModLengthMap(const ResGW& _G,
    2.32  		   const LengthMap &o,  const NodeMap &p) : 
    2.33  	G(_G), /*rev(_rev),*/ ol(o), pot(p){}; 
    2.34      };//ModLengthMap
    2.35 @@ -152,12 +152,12 @@
    2.36        
    2.37        
    2.38        //We need a residual graph
    2.39 -      ResGraphType res_graph(G, capacity, flow);
    2.40 +      ResGW res_graph(G, capacity, flow);
    2.41  
    2.42  
    2.43        ModLengthMap mod_length(res_graph, length, potential);
    2.44  
    2.45 -      Dijkstra<ResGraphType, ModLengthMap> dijkstra(res_graph, mod_length);
    2.46 +      Dijkstra<ResGW, ModLengthMap> dijkstra(res_graph, mod_length);
    2.47  
    2.48        int i;
    2.49        for (i=0; i<k; ++i){
    2.50 @@ -168,7 +168,7 @@
    2.51  	};
    2.52  	
    2.53  	//We have to change the potential
    2.54 -        for(typename ResGraphType::NodeIt n(res_graph); n!=INVALID; ++n)
    2.55 +        for(typename ResGW::NodeIt n(res_graph); n!=INVALID; ++n)
    2.56  	  potential[n] += dijkstra.distMap()[n];
    2.57  
    2.58  
     3.1 --- a/src/hugo/tight_edge_filter_map.h	Sun Sep 26 21:43:38 2004 +0000
     3.2 +++ b/src/hugo/tight_edge_filter_map.h	Mon Sep 27 18:11:27 2004 +0000
     3.3 @@ -17,6 +17,8 @@
     3.4  #ifndef HUGO_TIGHT_EDGE_FILTER_MAP_H
     3.5  #define HUGO_TIGHT_EDGE_FILTER_MAP_H
     3.6  
     3.7 +#include <hugo/maps.h>
     3.8 +
     3.9  // /// \file
    3.10  // /// \brief Maximum flow algorithms.
    3.11  // /// \ingroup galgs
    3.12 @@ -38,7 +40,7 @@
    3.13    /// types, e.g. with int.
    3.14    template<typename Graph, 
    3.15  	   typename NodePotentialMap, typename EdgeDistanceMap>
    3.16 -  class TightEdgeFilterMap {
    3.17 +  class TightEdgeFilterMap : public MapBase<typename Graph::Edge, bool> {
    3.18    protected:
    3.19      const Graph* g;
    3.20      NodePotentialMap* node_potential;