COIN-OR::LEMON - Graph Library

Changeset 2485:88aa7870756a in lemon-0.x for lemon


Ignore:
Timestamp:
10/02/07 14:34:43 (12 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3324
Message:

New developers page
The participation period should be included

Bug fix in doc related to Graph concpets

Removing some todos!

Location:
lemon
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lemon/concepts/bpugraph.h

    r2474 r2485  
    3434  namespace concepts {
    3535
    36     /// \addtogroup graph_concepts
    37     /// @{
     36    /// \ingroup graph_concepts
    3837    ///
    3938    /// \brief Class describing the concept of Bipartite Undirected Graphs.
     
    999998    };
    1000999
    1001 
    1002     /// @}
    1003 
    10041000  }
    10051001
  • lemon/concepts/graph.h

    r2474 r2485  
    3333  namespace concepts {
    3434
    35     /// \addtogroup graph_concepts
    36     /// @{
     35    /// \ingroup graph_concepts
    3736    ///
    3837    /// \brief Class describing the concept of Directed Graphs.
     
    447446    };
    448447   
    449     // @}
    450448  } //namespace concepts 
    451449} //namespace lemon
  • lemon/concepts/graph_components.h

    r2474 r2485  
    14831483      template <typename _Value>
    14841484      class NodeMap : public GraphMap<Graph, Node, _Value> {
    1485       private:
    1486         NodeMap();
    14871485      public:
    14881486        typedef GraphMap<MappableGraphComponent, Node, _Value> Parent;
     
    14911489        ///
    14921490        /// Construct a new map for the graph.
    1493         /// \todo call the right parent class constructor
    14941491        explicit NodeMap(const MappableGraphComponent& graph)
    14951492          : Parent(graph) {}
     
    15231520      template <typename _Value>
    15241521      class EdgeMap : public GraphMap<Graph, Edge, _Value> {
    1525       private:
    1526         EdgeMap();
    15271522      public:
    15281523        typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
     
    15311526        ///
    15321527        /// Construct a new map for the graph.
    1533         /// \todo call the right parent class constructor
    15341528        explicit EdgeMap(const MappableGraphComponent& graph)
    15351529          : Parent(graph) {}
     
    16281622        ///
    16291623        /// Construct a new map for the graph.
    1630         /// \todo call the right parent class constructor
    16311624        explicit UEdgeMap(const MappableUGraphComponent& graph)
    16321625          : Parent(graph) {}
     
    17131706        ///
    17141707        /// Construct a new map for the graph.
    1715         /// \todo call the right parent class constructor
    17161708        explicit ANodeMap(const MappableBpUGraphComponent& graph)
    17171709          : Parent(graph) {}
     
    17511743        ///
    17521744        /// Construct a new map for the graph.
    1753         /// \todo call the right parent class constructor
    17541745        explicit BNodeMap(const MappableBpUGraphComponent& graph)
    17551746          : Parent(graph) {}
  • lemon/concepts/ugraph.h

    r2474 r2485  
    3131  namespace concepts {
    3232
    33     /// \addtogroup graph_concepts
    34     /// @{
     33    /// \ingroup graph_concepts
    3534    ///
    3635    /// \brief Class describing the concept of Undirected Graphs.
     
    697696    };
    698697
    699     /// @}
    700 
    701698  }
    702699
  • lemon/graph_utils.h

    r2476 r2485  
    147147  /// graph structures it is specialized to run in O(1).
    148148  ///
    149   /// \todo Refer how to specialize it.
    150 
     149  /// If the graph contains a \e nodeNum() member function and a
     150  /// \e NodeNumTag tag then this function calls directly the member
     151  /// function to query the cardinality of the node set.
    151152  template <typename Graph>
    152153  inline int countNodes(const Graph& g) {
     
    180181  /// graph structures it is specialized to run in O(1).
    181182  ///
    182   /// \todo Refer how to specialize it.
    183 
     183  /// If the graph contains an \e aNodeNum() member function and a
     184  /// \e NodeNumTag tag then this function calls directly the member
     185  /// function to query the cardinality of the A-node set.
    184186  template <typename Graph>
    185187  inline int countANodes(const Graph& g) {
     
    213215  /// graph structures it is specialized to run in O(1).
    214216  ///
    215   /// \todo Refer how to specialize it.
    216 
     217  /// If the graph contains a \e bNodeNum() member function and a
     218  /// \e NodeNumTag tag then this function calls directly the member
     219  /// function to query the cardinality of the B-node set.
    217220  template <typename Graph>
    218221  inline int countBNodes(const Graph& g) {
     
    248251  /// The complexity of the function is O(e) but for some
    249252  /// graph structures it is specialized to run in O(1).
    250 
     253  ///
     254  /// If the graph contains a \e edgeNum() member function and a
     255  /// \e EdgeNumTag tag then this function calls directly the member
     256  /// function to query the cardinality of the edge set.
    251257  template <typename Graph>
    252258  inline int countEdges(const Graph& g) {
     
    280286  /// The complexity of the function is O(e) but for some
    281287  /// graph structures it is specialized to run in O(1).
    282 
     288  ///
     289  /// If the graph contains a \e uEdgeNum() member function and a
     290  /// \e EdgeNumTag tag then this function calls directly the member
     291  /// function to query the cardinality of the undirected edge set.
    283292  template <typename Graph>
    284293  inline int countUEdges(const Graph& g) {
     
    560569  /// \brief Copy a map.
    561570  ///
    562   /// This function copies the \c source map to the \c target map. It uses the
     571  /// This function copies the \c from map to the \c to map. It uses the
    563572  /// given iterator to iterate on the data structure and it uses the \c ref
    564   /// mapping to convert the source's keys to the target's keys.
    565   template <typename Target, typename Source,
     573  /// mapping to convert the from's keys to the to's keys.
     574  template <typename To, typename From,
    566575            typename ItemIt, typename Ref>         
    567   void copyMap(Target& target, const Source& source,
     576  void copyMap(To& to, const From& from,
    568577               ItemIt it, const Ref& ref) {
    569578    for (; it != INVALID; ++it) {
    570       target[ref[it]] = source[it];
    571     }
    572   }
    573 
    574   /// \brief Copy the source map to the target map.
    575   ///
    576   /// Copy the \c source map to the \c target map. It uses the given iterator
     579      to[ref[it]] = from[it];
     580    }
     581  }
     582
     583  /// \brief Copy the from map to the to map.
     584  ///
     585  /// Copy the \c from map to the \c to map. It uses the given iterator
    577586  /// to iterate on the data structure.
    578   template <typename Target, typename Source, typename ItemIt>     
    579   void copyMap(Target& target, const Source& source, ItemIt it) {
     587  template <typename To, typename From, typename ItemIt>           
     588  void copyMap(To& to, const From& from, ItemIt it) {
    580589    for (; it != INVALID; ++it) {
    581       target[it] = source[it];
     590      to[it] = from[it];
    582591    }
    583592  }
     
    588597    class MapCopyBase {
    589598    public:
    590       virtual void copy(const Graph& source, const RefMap& refMap) = 0;
     599      virtual void copy(const Graph& from, const RefMap& refMap) = 0;
    591600     
    592601      virtual ~MapCopyBase() {}
     
    594603
    595604    template <typename Graph, typename Item, typename RefMap,
    596               typename TargetMap, typename SourceMap>
     605              typename ToMap, typename FromMap>
    597606    class MapCopy : public MapCopyBase<Graph, Item, RefMap> {
    598607    public:
    599608
    600       MapCopy(TargetMap& tmap, const SourceMap& map)
     609      MapCopy(ToMap& tmap, const FromMap& map)
    601610        : _tmap(tmap), _map(map) {}
    602611     
     
    609618
    610619    private:
    611       TargetMap& _tmap;
    612       const SourceMap& _map;
     620      ToMap& _tmap;
     621      const FromMap& _map;
    613622    };
    614623
     
    665674    template <typename Graph, typename Enable = void>
    666675    struct GraphCopySelector {
    667       template <typename Source, typename NodeRefMap, typename EdgeRefMap>
    668       static void copy(Graph &target, const Source& source,
     676      template <typename From, typename NodeRefMap, typename EdgeRefMap>
     677      static void copy(Graph &to, const From& from,
    669678                       NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
    670         for (typename Source::NodeIt it(source); it != INVALID; ++it) {
    671           nodeRefMap[it] = target.addNode();
     679        for (typename From::NodeIt it(from); it != INVALID; ++it) {
     680          nodeRefMap[it] = to.addNode();
    672681        }
    673         for (typename Source::EdgeIt it(source); it != INVALID; ++it) {
    674           edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
    675                                           nodeRefMap[source.target(it)]);
     682        for (typename From::EdgeIt it(from); it != INVALID; ++it) {
     683          edgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)],
     684                                          nodeRefMap[from.target(it)]);
    676685        }
    677686      }
     
    683692      typename enable_if<typename Graph::BuildTag, void>::type>
    684693    {
    685       template <typename Source, typename NodeRefMap, typename EdgeRefMap>
    686       static void copy(Graph &target, const Source& source,
     694      template <typename From, typename NodeRefMap, typename EdgeRefMap>
     695      static void copy(Graph &to, const From& from,
    687696                       NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
    688         target.build(source, nodeRefMap, edgeRefMap);
     697        to.build(from, nodeRefMap, edgeRefMap);
    689698      }
    690699    };
     
    692701    template <typename UGraph, typename Enable = void>
    693702    struct UGraphCopySelector {
    694       template <typename Source, typename NodeRefMap, typename UEdgeRefMap>
    695       static void copy(UGraph &target, const Source& source,
     703      template <typename From, typename NodeRefMap, typename UEdgeRefMap>
     704      static void copy(UGraph &to, const From& from,
    696705                       NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) {
    697         for (typename Source::NodeIt it(source); it != INVALID; ++it) {
    698           nodeRefMap[it] = target.addNode();
     706        for (typename From::NodeIt it(from); it != INVALID; ++it) {
     707          nodeRefMap[it] = to.addNode();
    699708        }
    700         for (typename Source::UEdgeIt it(source); it != INVALID; ++it) {
    701           uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
    702                                           nodeRefMap[source.target(it)]);
     709        for (typename From::UEdgeIt it(from); it != INVALID; ++it) {
     710          uEdgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)],
     711                                       nodeRefMap[from.target(it)]);
    703712        }
    704713      }
     
    710719      typename enable_if<typename UGraph::BuildTag, void>::type>
    711720    {
    712       template <typename Source, typename NodeRefMap, typename UEdgeRefMap>
    713       static void copy(UGraph &target, const Source& source,
     721      template <typename From, typename NodeRefMap, typename UEdgeRefMap>
     722      static void copy(UGraph &to, const From& from,
    714723                       NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) {
    715         target.build(source, nodeRefMap, uEdgeRefMap);
     724        to.build(from, nodeRefMap, uEdgeRefMap);
    716725      }
    717726    };
     
    719728    template <typename BpUGraph, typename Enable = void>
    720729    struct BpUGraphCopySelector {
    721       template <typename Source, typename ANodeRefMap,
     730      template <typename From, typename ANodeRefMap,
    722731                typename BNodeRefMap, typename UEdgeRefMap>
    723       static void copy(BpUGraph &target, const Source& source,
     732      static void copy(BpUGraph &to, const From& from,
    724733                       ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap,
    725734                       UEdgeRefMap& uEdgeRefMap) {
    726         for (typename Source::ANodeIt it(source); it != INVALID; ++it) {
    727           aNodeRefMap[it] = target.addANode();
     735        for (typename From::ANodeIt it(from); it != INVALID; ++it) {
     736          aNodeRefMap[it] = to.addANode();
    728737        }
    729         for (typename Source::BNodeIt it(source); it != INVALID; ++it) {
    730           bNodeRefMap[it] = target.addBNode();
     738        for (typename From::BNodeIt it(from); it != INVALID; ++it) {
     739          bNodeRefMap[it] = to.addBNode();
    731740        }
    732         for (typename Source::UEdgeIt it(source); it != INVALID; ++it) {
    733           uEdgeRefMap[it] = target.addEdge(aNodeRefMap[source.aNode(it)],
    734                                            bNodeRefMap[source.bNode(it)]);
     741        for (typename From::UEdgeIt it(from); it != INVALID; ++it) {
     742          uEdgeRefMap[it] = to.addEdge(aNodeRefMap[from.aNode(it)],
     743                                           bNodeRefMap[from.bNode(it)]);
    735744        }
    736745      }
     
    742751      typename enable_if<typename BpUGraph::BuildTag, void>::type>
    743752    {
    744       template <typename Source, typename ANodeRefMap,
     753      template <typename From, typename ANodeRefMap,
    745754                typename BNodeRefMap, typename UEdgeRefMap>
    746       static void copy(BpUGraph &target, const Source& source,
     755      static void copy(BpUGraph &to, const From& from,
    747756                       ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap,
    748757                       UEdgeRefMap& uEdgeRefMap) {
    749         target.build(source, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
     758        to.build(from, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
    750759      }
    751760    };
     
    758767  /// Class to copy a graph to another graph (duplicate a graph). The
    759768  /// simplest way of using it is through the \c copyGraph() function.
    760   template <typename Target, typename Source>
     769  template <typename To, typename From>
    761770  class GraphCopy {
    762771  private:
    763772
    764     typedef typename Source::Node Node;
    765     typedef typename Source::NodeIt NodeIt;
    766     typedef typename Source::Edge Edge;
    767     typedef typename Source::EdgeIt EdgeIt;
    768 
    769     typedef typename Target::Node TNode;
    770     typedef typename Target::Edge TEdge;
    771 
    772     typedef typename Source::template NodeMap<TNode> NodeRefMap;
    773     typedef typename Source::template EdgeMap<TEdge> EdgeRefMap;
     773    typedef typename From::Node Node;
     774    typedef typename From::NodeIt NodeIt;
     775    typedef typename From::Edge Edge;
     776    typedef typename From::EdgeIt EdgeIt;
     777
     778    typedef typename To::Node TNode;
     779    typedef typename To::Edge TEdge;
     780
     781    typedef typename From::template NodeMap<TNode> NodeRefMap;
     782    typedef typename From::template EdgeMap<TEdge> EdgeRefMap;
    774783   
    775784   
     
    779788    /// \brief Constructor for the GraphCopy.
    780789    ///
    781     /// It copies the content of the \c _source graph into the
    782     /// \c _target graph.
    783     GraphCopy(Target& _target, const Source& _source)
    784       : source(_source), target(_target) {}
     790    /// It copies the content of the \c _from graph into the
     791    /// \c _to graph.
     792    GraphCopy(To& _to, const From& _from)
     793      : from(_from), to(_to) {}
    785794
    786795    /// \brief Destructor of the GraphCopy
     
    802811    template <typename NodeRef>
    803812    GraphCopy& nodeRef(NodeRef& map) {
    804       nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node,
     813      nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
    805814                              NodeRefMap, NodeRef>(map));
    806815      return *this;
     
    813822    template <typename NodeCrossRef>
    814823    GraphCopy& nodeCrossRef(NodeCrossRef& map) {
    815       nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
     824      nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
    816825                              NodeRefMap, NodeCrossRef>(map));
    817826      return *this;
     
    821830    ///
    822831    /// Makes copy of the given map for the newly created graph.
    823     /// The new map's key type is the target graph's node type,
    824     /// and the copied map's key type is the source graph's node
     832    /// The new map's key type is the to graph's node type,
     833    /// and the copied map's key type is the from graph's node
    825834    /// type. 
    826     template <typename TargetMap, typename SourceMap>
    827     GraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
    828       nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node,
    829                               NodeRefMap, TargetMap, SourceMap>(tmap, map));
     835    template <typename ToMap, typename FromMap>
     836    GraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
     837      nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
     838                              NodeRefMap, ToMap, FromMap>(tmap, map));
    830839      return *this;
    831840    }
     
    835844    /// Make a copy of the given node.
    836845    GraphCopy& node(TNode& tnode, const Node& snode) {
    837       nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
     846      nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
    838847                              NodeRefMap, TNode>(tnode, snode));
    839848      return *this;
     
    845854    template <typename EdgeRef>
    846855    GraphCopy& edgeRef(EdgeRef& map) {
    847       edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge,
     856      edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
    848857                              EdgeRefMap, EdgeRef>(map));
    849858      return *this;
     
    856865    template <typename EdgeCrossRef>
    857866    GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
    858       edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
     867      edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
    859868                              EdgeRefMap, EdgeCrossRef>(map));
    860869      return *this;
     
    864873    ///
    865874    /// Makes copy of the given map for the newly created graph.
    866     /// The new map's key type is the target graph's edge type,
    867     /// and the copied map's key type is the source graph's edge
     875    /// The new map's key type is the to graph's edge type,
     876    /// and the copied map's key type is the from graph's edge
    868877    /// type. 
    869     template <typename TargetMap, typename SourceMap>
    870     GraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
    871       edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge,
    872                               EdgeRefMap, TargetMap, SourceMap>(tmap, map));
     878    template <typename ToMap, typename FromMap>
     879    GraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
     880      edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
     881                              EdgeRefMap, ToMap, FromMap>(tmap, map));
    873882      return *this;
    874883    }
     
    878887    /// Make a copy of the given edge.
    879888    GraphCopy& edge(TEdge& tedge, const Edge& sedge) {
    880       edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
     889      edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
    881890                              EdgeRefMap, TEdge>(tedge, sedge));
    882891      return *this;
     
    887896    /// Executes the copies.
    888897    void run() {
    889       NodeRefMap nodeRefMap(source);
    890       EdgeRefMap edgeRefMap(source);
    891       _graph_utils_bits::GraphCopySelector<Target>::
    892         copy(target, source, nodeRefMap, edgeRefMap);
     898      NodeRefMap nodeRefMap(from);
     899      EdgeRefMap edgeRefMap(from);
     900      _graph_utils_bits::GraphCopySelector<To>::
     901        copy(to, from, nodeRefMap, edgeRefMap);
    893902      for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
    894         nodeMapCopies[i]->copy(source, nodeRefMap);
     903        nodeMapCopies[i]->copy(from, nodeRefMap);
    895904      }
    896905      for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
    897         edgeMapCopies[i]->copy(source, edgeRefMap);
     906        edgeMapCopies[i]->copy(from, edgeRefMap);
    898907      }     
    899908    }
     
    902911
    903912
    904     const Source& source;
    905     Target& target;
    906 
    907     std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* >
     913    const From& from;
     914    To& to;
     915
     916    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
    908917    nodeMapCopies;
    909918
    910     std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* >
     919    std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
    911920    edgeMapCopies;
    912921
     
    923932  ///
    924933  /// After the copy the \c nr map will contain the mapping from the
    925   /// source graph's nodes to the target graph's nodes and the \c ecr will
    926   /// contain the mapping from the target graph's edges to the source's
     934  /// from graph's nodes to the to graph's nodes and the \c ecr will
     935  /// contain the mapping from the to graph's edges to the from's
    927936  /// edges.
    928937  ///
    929938  /// \see GraphCopy
    930   template <typename Target, typename Source>
    931   GraphCopy<Target, Source> copyGraph(Target& target, const Source& source) {
    932     return GraphCopy<Target, Source>(target, source);
     939  template <typename To, typename From>
     940  GraphCopy<To, From> copyGraph(To& to, const From& from) {
     941    return GraphCopy<To, From>(to, from);
    933942  }
    934943
     
    937946  /// Class to copy an undirected graph to another graph (duplicate a graph).
    938947  /// The simplest way of using it is through the \c copyUGraph() function.
    939   template <typename Target, typename Source>
     948  template <typename To, typename From>
    940949  class UGraphCopy {
    941950  private:
    942951
    943     typedef typename Source::Node Node;
    944     typedef typename Source::NodeIt NodeIt;
    945     typedef typename Source::Edge Edge;
    946     typedef typename Source::EdgeIt EdgeIt;
    947     typedef typename Source::UEdge UEdge;
    948     typedef typename Source::UEdgeIt UEdgeIt;
    949 
    950     typedef typename Target::Node TNode;
    951     typedef typename Target::Edge TEdge;
    952     typedef typename Target::UEdge TUEdge;
    953 
    954     typedef typename Source::template NodeMap<TNode> NodeRefMap;
    955     typedef typename Source::template UEdgeMap<TUEdge> UEdgeRefMap;
     952    typedef typename From::Node Node;
     953    typedef typename From::NodeIt NodeIt;
     954    typedef typename From::Edge Edge;
     955    typedef typename From::EdgeIt EdgeIt;
     956    typedef typename From::UEdge UEdge;
     957    typedef typename From::UEdgeIt UEdgeIt;
     958
     959    typedef typename To::Node TNode;
     960    typedef typename To::Edge TEdge;
     961    typedef typename To::UEdge TUEdge;
     962
     963    typedef typename From::template NodeMap<TNode> NodeRefMap;
     964    typedef typename From::template UEdgeMap<TUEdge> UEdgeRefMap;
    956965
    957966    struct EdgeRefMap {
    958       EdgeRefMap(const Target& _target, const Source& _source,
     967      EdgeRefMap(const To& _to, const From& _from,
    959968                 const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref)
    960         : target(_target), source(_source),
     969        : to(_to), from(_from),
    961970          uedge_ref(_uedge_ref), node_ref(_node_ref) {}
    962971
    963       typedef typename Source::Edge Key;
    964       typedef typename Target::Edge Value;
     972      typedef typename From::Edge Key;
     973      typedef typename To::Edge Value;
    965974
    966975      Value operator[](const Key& key) const {
    967976        bool forward =
    968           (source.direction(key) ==
    969            (node_ref[source.source(static_cast<const UEdge&>(key))] ==
    970             target.source(uedge_ref[static_cast<const UEdge&>(key)])));
    971         return target.direct(uedge_ref[key], forward);
     977          (from.direction(key) ==
     978           (node_ref[from.source(static_cast<const UEdge&>(key))] ==
     979            to.source(uedge_ref[static_cast<const UEdge&>(key)])));
     980        return to.direct(uedge_ref[key], forward);
    972981      }
    973982     
    974       const Target& target;
    975       const Source& source;
     983      const To& to;
     984      const From& from;
    976985      const UEdgeRefMap& uedge_ref;
    977986      const NodeRefMap& node_ref;
     
    984993    /// \brief Constructor for the GraphCopy.
    985994    ///
    986     /// It copies the content of the \c _source graph into the
    987     /// \c _target graph.
    988     UGraphCopy(Target& _target, const Source& _source)
    989       : source(_source), target(_target) {}
     995    /// It copies the content of the \c _from graph into the
     996    /// \c _to graph.
     997    UGraphCopy(To& _to, const From& _from)
     998      : from(_from), to(_to) {}
    990999
    9911000    /// \brief Destructor of the GraphCopy
     
    10101019    template <typename NodeRef>
    10111020    UGraphCopy& nodeRef(NodeRef& map) {
    1012       nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node,
     1021      nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
    10131022                              NodeRefMap, NodeRef>(map));
    10141023      return *this;
     
    10211030    template <typename NodeCrossRef>
    10221031    UGraphCopy& nodeCrossRef(NodeCrossRef& map) {
    1023       nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
     1032      nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
    10241033                              NodeRefMap, NodeCrossRef>(map));
    10251034      return *this;
     
    10291038    ///
    10301039    /// Makes copy of the given map for the newly created graph.
    1031     /// The new map's key type is the target graph's node type,
    1032     /// and the copied map's key type is the source graph's node
     1040    /// The new map's key type is the to graph's node type,
     1041    /// and the copied map's key type is the from graph's node
    10331042    /// type. 
    1034     template <typename TargetMap, typename SourceMap>
    1035     UGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
    1036       nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node,
    1037                               NodeRefMap, TargetMap, SourceMap>(tmap, map));
     1043    template <typename ToMap, typename FromMap>
     1044    UGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
     1045      nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
     1046                              NodeRefMap, ToMap, FromMap>(tmap, map));
    10381047      return *this;
    10391048    }
     
    10431052    /// Make a copy of the given node.
    10441053    UGraphCopy& node(TNode& tnode, const Node& snode) {
    1045       nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
     1054      nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
    10461055                              NodeRefMap, TNode>(tnode, snode));
    10471056      return *this;
     
    10531062    template <typename EdgeRef>
    10541063    UGraphCopy& edgeRef(EdgeRef& map) {
    1055       edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge,
     1064      edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
    10561065                              EdgeRefMap, EdgeRef>(map));
    10571066      return *this;
     
    10641073    template <typename EdgeCrossRef>
    10651074    UGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
    1066       edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
     1075      edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
    10671076                              EdgeRefMap, EdgeCrossRef>(map));
    10681077      return *this;
     
    10721081    ///
    10731082    /// Makes copy of the given map for the newly created graph.
    1074     /// The new map's key type is the target graph's edge type,
    1075     /// and the copied map's key type is the source graph's edge
     1083    /// The new map's key type is the to graph's edge type,
     1084    /// and the copied map's key type is the from graph's edge
    10761085    /// type. 
    1077     template <typename TargetMap, typename SourceMap>
    1078     UGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
    1079       edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge,
    1080                               EdgeRefMap, TargetMap, SourceMap>(tmap, map));
     1086    template <typename ToMap, typename FromMap>
     1087    UGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
     1088      edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
     1089                              EdgeRefMap, ToMap, FromMap>(tmap, map));
    10811090      return *this;
    10821091    }
     
    10861095    /// Make a copy of the given edge.
    10871096    UGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
    1088       edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
     1097      edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
    10891098                              EdgeRefMap, TEdge>(tedge, sedge));
    10901099      return *this;
     
    10961105    template <typename UEdgeRef>
    10971106    UGraphCopy& uEdgeRef(UEdgeRef& map) {
    1098       uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, UEdge,
     1107      uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, UEdge,
    10991108                               UEdgeRefMap, UEdgeRef>(map));
    11001109      return *this;
     
    11071116    template <typename UEdgeCrossRef>
    11081117    UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
    1109       uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source,
     1118      uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
    11101119                               UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
    11111120      return *this;
     
    11151124    ///
    11161125    /// Makes copy of the given map for the newly created graph.
    1117     /// The new map's key type is the target graph's undirected edge type,
    1118     /// and the copied map's key type is the source graph's undirected edge
     1126    /// The new map's key type is the to graph's undirected edge type,
     1127    /// and the copied map's key type is the from graph's undirected edge
    11191128    /// type. 
    1120     template <typename TargetMap, typename SourceMap>
    1121     UGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) {
    1122       uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, UEdge,
    1123                                UEdgeRefMap, TargetMap, SourceMap>(tmap, map));
     1129    template <typename ToMap, typename FromMap>
     1130    UGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) {
     1131      uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, UEdge,
     1132                               UEdgeRefMap, ToMap, FromMap>(tmap, map));
    11241133      return *this;
    11251134    }
     
    11291138    /// Make a copy of the given undirected edge.
    11301139    UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
    1131       uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge,
     1140      uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, UEdge,
    11321141                               UEdgeRefMap, TUEdge>(tuedge, suedge));
    11331142      return *this;
     
    11381147    /// Executes the copies.
    11391148    void run() {
    1140       NodeRefMap nodeRefMap(source);
    1141       UEdgeRefMap uEdgeRefMap(source);
    1142       EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
    1143       _graph_utils_bits::UGraphCopySelector<Target>::
    1144         copy(target, source, nodeRefMap, uEdgeRefMap);
     1149      NodeRefMap nodeRefMap(from);
     1150      UEdgeRefMap uEdgeRefMap(from);
     1151      EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap);
     1152      _graph_utils_bits::UGraphCopySelector<To>::
     1153        copy(to, from, nodeRefMap, uEdgeRefMap);
    11451154      for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
    1146         nodeMapCopies[i]->copy(source, nodeRefMap);
     1155        nodeMapCopies[i]->copy(from, nodeRefMap);
    11471156      }
    11481157      for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
    1149         uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
     1158        uEdgeMapCopies[i]->copy(from, uEdgeRefMap);
    11501159      }
    11511160      for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
    1152         edgeMapCopies[i]->copy(source, edgeRefMap);
     1161        edgeMapCopies[i]->copy(from, edgeRefMap);
    11531162      }
    11541163    }
     
    11561165  private:
    11571166   
    1158     const Source& source;
    1159     Target& target;
    1160 
    1161     std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* >
     1167    const From& from;
     1168    To& to;
     1169
     1170    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
    11621171    nodeMapCopies;
    11631172
    1164     std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* >
     1173    std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
    11651174    edgeMapCopies;
    11661175
    1167     std::vector<_graph_utils_bits::MapCopyBase<Source, UEdge, UEdgeRefMap>* >
     1176    std::vector<_graph_utils_bits::MapCopyBase<From, UEdge, UEdgeRefMap>* >
    11681177    uEdgeMapCopies;
    11691178
     
    11801189  ///
    11811190  /// After the copy the \c nr map will contain the mapping from the
    1182   /// source graph's nodes to the target graph's nodes and the \c ecr will
    1183   /// contain the mapping from the target graph's edges to the source's
     1191  /// from graph's nodes to the to graph's nodes and the \c ecr will
     1192  /// contain the mapping from the to graph's edges to the from's
    11841193  /// edges.
    11851194  ///
    11861195  /// \see UGraphCopy
    1187   template <typename Target, typename Source>
    1188   UGraphCopy<Target, Source>
    1189   copyUGraph(Target& target, const Source& source) {
    1190     return UGraphCopy<Target, Source>(target, source);
     1196  template <typename To, typename From>
     1197  UGraphCopy<To, From>
     1198  copyUGraph(To& to, const From& from) {
     1199    return UGraphCopy<To, From>(to, from);
    11911200  }
    11921201
     
    11961205  /// (duplicate a graph).  The simplest way of using it is through
    11971206  /// the \c copyBpUGraph() function.
    1198   template <typename Target, typename Source>
     1207  template <typename To, typename From>
    11991208  class BpUGraphCopy {
    12001209  private:
    12011210
    1202     typedef typename Source::Node Node;
    1203     typedef typename Source::ANode ANode;
    1204     typedef typename Source::BNode BNode;
    1205     typedef typename Source::NodeIt NodeIt;
    1206     typedef typename Source::Edge Edge;
    1207     typedef typename Source::EdgeIt EdgeIt;
    1208     typedef typename Source::UEdge UEdge;
    1209     typedef typename Source::UEdgeIt UEdgeIt;
    1210 
    1211     typedef typename Target::Node TNode;
    1212     typedef typename Target::Edge TEdge;
    1213     typedef typename Target::UEdge TUEdge;
    1214 
    1215     typedef typename Source::template ANodeMap<TNode> ANodeRefMap;
    1216     typedef typename Source::template BNodeMap<TNode> BNodeRefMap;
    1217     typedef typename Source::template UEdgeMap<TUEdge> UEdgeRefMap;
     1211    typedef typename From::Node Node;
     1212    typedef typename From::ANode ANode;
     1213    typedef typename From::BNode BNode;
     1214    typedef typename From::NodeIt NodeIt;
     1215    typedef typename From::Edge Edge;
     1216    typedef typename From::EdgeIt EdgeIt;
     1217    typedef typename From::UEdge UEdge;
     1218    typedef typename From::UEdgeIt UEdgeIt;
     1219
     1220    typedef typename To::Node TNode;
     1221    typedef typename To::Edge TEdge;
     1222    typedef typename To::UEdge TUEdge;
     1223
     1224    typedef typename From::template ANodeMap<TNode> ANodeRefMap;
     1225    typedef typename From::template BNodeMap<TNode> BNodeRefMap;
     1226    typedef typename From::template UEdgeMap<TUEdge> UEdgeRefMap;
    12181227
    12191228    struct NodeRefMap {
    1220       NodeRefMap(const Source& _source, const ANodeRefMap& _anode_ref,
     1229      NodeRefMap(const From& _from, const ANodeRefMap& _anode_ref,
    12211230                 const BNodeRefMap& _bnode_ref)
    1222         : source(_source), anode_ref(_anode_ref), bnode_ref(_bnode_ref) {}
    1223 
    1224       typedef typename Source::Node Key;
    1225       typedef typename Target::Node Value;
     1231        : from(_from), anode_ref(_anode_ref), bnode_ref(_bnode_ref) {}
     1232
     1233      typedef typename From::Node Key;
     1234      typedef typename To::Node Value;
    12261235
    12271236      Value operator[](const Key& key) const {
    1228         return source.aNode(key) ? anode_ref[key] : bnode_ref[key];
     1237        return from.aNode(key) ? anode_ref[key] : bnode_ref[key];
    12291238      }
    12301239     
    1231       const Source& source;
     1240      const From& from;
    12321241      const ANodeRefMap& anode_ref;
    12331242      const BNodeRefMap& bnode_ref;
     
    12351244
    12361245    struct EdgeRefMap {
    1237       EdgeRefMap(const Target& _target, const Source& _source,
     1246      EdgeRefMap(const To& _to, const From& _from,
    12381247                 const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref)
    1239         : target(_target), source(_source),
     1248        : to(_to), from(_from),
    12401249          uedge_ref(_uedge_ref), node_ref(_node_ref) {}
    12411250
    1242       typedef typename Source::Edge Key;
    1243       typedef typename Target::Edge Value;
     1251      typedef typename From::Edge Key;
     1252      typedef typename To::Edge Value;
    12441253
    12451254      Value operator[](const Key& key) const {
    12461255        bool forward =
    1247           (source.direction(key) ==
    1248            (node_ref[source.source(static_cast<const UEdge&>(key))] ==
    1249             target.source(uedge_ref[static_cast<const UEdge&>(key)])));
    1250         return target.direct(uedge_ref[key], forward);
     1256          (from.direction(key) ==
     1257           (node_ref[from.source(static_cast<const UEdge&>(key))] ==
     1258            to.source(uedge_ref[static_cast<const UEdge&>(key)])));
     1259        return to.direct(uedge_ref[key], forward);
    12511260      }
    12521261     
    1253       const Target& target;
    1254       const Source& source;
     1262      const To& to;
     1263      const From& from;
    12551264      const UEdgeRefMap& uedge_ref;
    12561265      const NodeRefMap& node_ref;
     
    12621271    /// \brief Constructor for the GraphCopy.
    12631272    ///
    1264     /// It copies the content of the \c _source graph into the
    1265     /// \c _target graph.
    1266     BpUGraphCopy(Target& _target, const Source& _source)
    1267       : source(_source), target(_target) {}
     1273    /// It copies the content of the \c _from graph into the
     1274    /// \c _to graph.
     1275    BpUGraphCopy(To& _to, const From& _from)
     1276      : from(_from), to(_to) {}
    12681277
    12691278    /// \brief Destructor of the GraphCopy
     
    12941303    template <typename ANodeRef>
    12951304    BpUGraphCopy& aNodeRef(ANodeRef& map) {
    1296       aNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, ANode,
     1305      aNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, ANode,
    12971306                               ANodeRefMap, ANodeRef>(map));
    12981307      return *this;
     
    13051314    template <typename ANodeCrossRef>
    13061315    BpUGraphCopy& aNodeCrossRef(ANodeCrossRef& map) {
    1307       aNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source,
     1316      aNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
    13081317                               ANode, ANodeRefMap, ANodeCrossRef>(map));
    13091318      return *this;
     
    13131322    ///
    13141323    /// Makes copy of the given map for the newly created graph.
    1315     /// The new map's key type is the target graph's node type,
    1316     /// and the copied map's key type is the source graph's node
     1324    /// The new map's key type is the to graph's node type,
     1325    /// and the copied map's key type is the from graph's node
    13171326    /// type. 
    1318     template <typename TargetMap, typename SourceMap>
    1319     BpUGraphCopy& aNodeMap(TargetMap& tmap, const SourceMap& map) {
    1320       aNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, ANode,
    1321                                ANodeRefMap, TargetMap, SourceMap>(tmap, map));
     1327    template <typename ToMap, typename FromMap>
     1328    BpUGraphCopy& aNodeMap(ToMap& tmap, const FromMap& map) {
     1329      aNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, ANode,
     1330                               ANodeRefMap, ToMap, FromMap>(tmap, map));
    13221331      return *this;
    13231332    }
     
    13281337    template <typename BNodeRef>
    13291338    BpUGraphCopy& bNodeRef(BNodeRef& map) {
    1330       bNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, BNode,
     1339      bNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, BNode,
    13311340                               BNodeRefMap, BNodeRef>(map));
    13321341      return *this;
     
    13391348    template <typename BNodeCrossRef>
    13401349    BpUGraphCopy& bNodeCrossRef(BNodeCrossRef& map) {
    1341       bNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source,
     1350      bNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
    13421351                              BNode, BNodeRefMap, BNodeCrossRef>(map));
    13431352      return *this;
     
    13471356    ///
    13481357    /// Makes copy of the given map for the newly created graph.
    1349     /// The new map's key type is the target graph's node type,
    1350     /// and the copied map's key type is the source graph's node
     1358    /// The new map's key type is the to graph's node type,
     1359    /// and the copied map's key type is the from graph's node
    13511360    /// type. 
    1352     template <typename TargetMap, typename SourceMap>
    1353     BpUGraphCopy& bNodeMap(TargetMap& tmap, const SourceMap& map) {
    1354       bNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, BNode,
    1355                                BNodeRefMap, TargetMap, SourceMap>(tmap, map));
     1361    template <typename ToMap, typename FromMap>
     1362    BpUGraphCopy& bNodeMap(ToMap& tmap, const FromMap& map) {
     1363      bNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, BNode,
     1364                               BNodeRefMap, ToMap, FromMap>(tmap, map));
    13561365      return *this;
    13571366    }
     
    13611370    template <typename NodeRef>
    13621371    BpUGraphCopy& nodeRef(NodeRef& map) {
    1363       nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node,
     1372      nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
    13641373                              NodeRefMap, NodeRef>(map));
    13651374      return *this;
     
    13721381    template <typename NodeCrossRef>
    13731382    BpUGraphCopy& nodeCrossRef(NodeCrossRef& map) {
    1374       nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
     1383      nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
    13751384                              NodeRefMap, NodeCrossRef>(map));
    13761385      return *this;
     
    13801389    ///
    13811390    /// Makes copy of the given map for the newly created graph.
    1382     /// The new map's key type is the target graph's node type,
    1383     /// and the copied map's key type is the source graph's node
     1391    /// The new map's key type is the to graph's node type,
     1392    /// and the copied map's key type is the from graph's node
    13841393    /// type. 
    1385     template <typename TargetMap, typename SourceMap>
    1386     BpUGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
    1387       nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node,
    1388                               NodeRefMap, TargetMap, SourceMap>(tmap, map));
     1394    template <typename ToMap, typename FromMap>
     1395    BpUGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
     1396      nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
     1397                              NodeRefMap, ToMap, FromMap>(tmap, map));
    13891398      return *this;
    13901399    }
     
    13941403    /// Make a copy of the given node.
    13951404    BpUGraphCopy& node(TNode& tnode, const Node& snode) {
    1396       nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
     1405      nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
    13971406                              NodeRefMap, TNode>(tnode, snode));
    13981407      return *this;
     
    14041413    template <typename EdgeRef>
    14051414    BpUGraphCopy& edgeRef(EdgeRef& map) {
    1406       edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge,
     1415      edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
    14071416                              EdgeRefMap, EdgeRef>(map));
    14081417      return *this;
     
    14151424    template <typename EdgeCrossRef>
    14161425    BpUGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
    1417       edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
     1426      edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
    14181427                              EdgeRefMap, EdgeCrossRef>(map));
    14191428      return *this;
     
    14231432    ///
    14241433    /// Makes copy of the given map for the newly created graph.
    1425     /// The new map's key type is the target graph's edge type,
    1426     /// and the copied map's key type is the source graph's edge
     1434    /// The new map's key type is the to graph's edge type,
     1435    /// and the copied map's key type is the from graph's edge
    14271436    /// type. 
    1428     template <typename TargetMap, typename SourceMap>
    1429     BpUGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
    1430       edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge,
    1431                               EdgeRefMap, TargetMap, SourceMap>(tmap, map));
     1437    template <typename ToMap, typename FromMap>
     1438    BpUGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
     1439      edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
     1440                              EdgeRefMap, ToMap, FromMap>(tmap, map));
    14321441      return *this;
    14331442    }
     
    14371446    /// Make a copy of the given edge.
    14381447    BpUGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
    1439       edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
     1448      edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
    14401449                              EdgeRefMap, TEdge>(tedge, sedge));
    14411450      return *this;
     
    14471456    template <typename UEdgeRef>
    14481457    BpUGraphCopy& uEdgeRef(UEdgeRef& map) {
    1449       uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, UEdge,
     1458      uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, UEdge,
    14501459                               UEdgeRefMap, UEdgeRef>(map));
    14511460      return *this;
     
    14581467    template <typename UEdgeCrossRef>
    14591468    BpUGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
    1460       uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source,
     1469      uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
    14611470                               UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
    14621471      return *this;
     
    14661475    ///
    14671476    /// Makes copy of the given map for the newly created graph.
    1468     /// The new map's key type is the target graph's undirected edge type,
    1469     /// and the copied map's key type is the source graph's undirected edge
     1477    /// The new map's key type is the to graph's undirected edge type,
     1478    /// and the copied map's key type is the from graph's undirected edge
    14701479    /// type. 
    1471     template <typename TargetMap, typename SourceMap>
    1472     BpUGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) {
    1473       uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, UEdge,
    1474                                UEdgeRefMap, TargetMap, SourceMap>(tmap, map));
     1480    template <typename ToMap, typename FromMap>
     1481    BpUGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) {
     1482      uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, UEdge,
     1483                               UEdgeRefMap, ToMap, FromMap>(tmap, map));
    14751484      return *this;
    14761485    }
     
    14801489    /// Make a copy of the given undirected edge.
    14811490    BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
    1482       uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge,
     1491      uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, UEdge,
    14831492                               UEdgeRefMap, TUEdge>(tuedge, suedge));
    14841493      return *this;
     
    14891498    /// Executes the copies.
    14901499    void run() {
    1491       ANodeRefMap aNodeRefMap(source);
    1492       BNodeRefMap bNodeRefMap(source);
    1493       NodeRefMap nodeRefMap(source, aNodeRefMap, bNodeRefMap);
    1494       UEdgeRefMap uEdgeRefMap(source);
    1495       EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
    1496       _graph_utils_bits::BpUGraphCopySelector<Target>::
    1497         copy(target, source, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
     1500      ANodeRefMap aNodeRefMap(from);
     1501      BNodeRefMap bNodeRefMap(from);
     1502      NodeRefMap nodeRefMap(from, aNodeRefMap, bNodeRefMap);
     1503      UEdgeRefMap uEdgeRefMap(from);
     1504      EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap);
     1505      _graph_utils_bits::BpUGraphCopySelector<To>::
     1506        copy(to, from, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
    14981507      for (int i = 0; i < int(aNodeMapCopies.size()); ++i) {
    1499         aNodeMapCopies[i]->copy(source, aNodeRefMap);
     1508        aNodeMapCopies[i]->copy(from, aNodeRefMap);
    15001509      }
    15011510      for (int i = 0; i < int(bNodeMapCopies.size()); ++i) {
    1502         bNodeMapCopies[i]->copy(source, bNodeRefMap);
     1511        bNodeMapCopies[i]->copy(from, bNodeRefMap);
    15031512      }
    15041513      for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
    1505         nodeMapCopies[i]->copy(source, nodeRefMap);
     1514        nodeMapCopies[i]->copy(from, nodeRefMap);
    15061515      }
    15071516      for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
    1508         uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
     1517        uEdgeMapCopies[i]->copy(from, uEdgeRefMap);
    15091518      }
    15101519      for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
    1511         edgeMapCopies[i]->copy(source, edgeRefMap);
     1520        edgeMapCopies[i]->copy(from, edgeRefMap);
    15121521      }
    15131522    }
     
    15151524  private:
    15161525   
    1517     const Source& source;
    1518     Target& target;
    1519 
    1520     std::vector<_graph_utils_bits::MapCopyBase<Source, ANode, ANodeRefMap>* >
     1526    const From& from;
     1527    To& to;
     1528
     1529    std::vector<_graph_utils_bits::MapCopyBase<From, ANode, ANodeRefMap>* >
    15211530    aNodeMapCopies;
    15221531
    1523     std::vector<_graph_utils_bits::MapCopyBase<Source, BNode, BNodeRefMap>* >
     1532    std::vector<_graph_utils_bits::MapCopyBase<From, BNode, BNodeRefMap>* >
    15241533    bNodeMapCopies;
    15251534
    1526     std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* >
     1535    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
    15271536    nodeMapCopies;
    15281537
    1529     std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* >
     1538    std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
    15301539    edgeMapCopies;
    15311540
    1532     std::vector<_graph_utils_bits::MapCopyBase<Source, UEdge, UEdgeRefMap>* >
     1541    std::vector<_graph_utils_bits::MapCopyBase<From, UEdge, UEdgeRefMap>* >
    15331542    uEdgeMapCopies;
    15341543
     
    15451554  ///
    15461555  /// After the copy the \c nr map will contain the mapping from the
    1547   /// source graph's nodes to the target graph's nodes and the \c ecr will
    1548   /// contain the mapping from the target graph's edges to the source's
     1556  /// from graph's nodes to the to graph's nodes and the \c ecr will
     1557  /// contain the mapping from the to graph's edges to the from's
    15491558  /// edges.
    15501559  ///
    15511560  /// \see BpUGraphCopy
    1552   template <typename Target, typename Source>
    1553   BpUGraphCopy<Target, Source>
    1554   copyBpUGraph(Target& target, const Source& source) {
    1555     return BpUGraphCopy<Target, Source>(target, source);
     1561  template <typename To, typename From>
     1562  BpUGraphCopy<To, From>
     1563  copyBpUGraph(To& to, const From& from) {
     1564    return BpUGraphCopy<To, From>(to, from);
    15561565  }
    15571566
Note: See TracChangeset for help on using the changeset viewer.