# HG changeset patch # User deba # Date 1191328483 0 # Node ID 88aa7870756a789e69282b1915768fe6a7586171 # Parent 51995c1f10936f0b46b005fb565fff8666f3cf3d New developers page The participation period should be included Bug fix in doc related to Graph concpets Removing some todos! diff -r 51995c1f1093 -r 88aa7870756a doc/Makefile.am --- a/doc/Makefile.am Mon Oct 01 19:23:16 2007 +0000 +++ b/doc/Makefile.am Tue Oct 02 12:34:43 2007 +0000 @@ -10,6 +10,7 @@ doc/algorithms.dox \ doc/coding_style.dox \ doc/developers_interface.dox \ + doc/developres.dox \ doc/dirs.dox \ doc/getstart.dox \ doc/graph-adaptors.dox \ diff -r 51995c1f1093 -r 88aa7870756a doc/developers.dox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/developers.dox Tue Oct 02 12:34:43 2007 +0000 @@ -0,0 +1,41 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2007 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +namespace lemon { +/*! + + +\page developers LEMON Developers + +\li Mihaly Barasz +\li Johanna Becker +\li Attila Bernath +\li Balazs Dezso +\li Peter Hegyi +\li Alpar Juttner +\li Peter Kovacs +\li Akos Ladanyi +\li Marton Makai +\li Balazs Attila Mihaly +\li Janos Nagy +\li Jacint Szabo +\li Zsuzsanna Vaik + +*/ +} + diff -r 51995c1f1093 -r 88aa7870756a lemon/concepts/bpugraph.h --- a/lemon/concepts/bpugraph.h Mon Oct 01 19:23:16 2007 +0000 +++ b/lemon/concepts/bpugraph.h Tue Oct 02 12:34:43 2007 +0000 @@ -33,8 +33,7 @@ namespace lemon { namespace concepts { - /// \addtogroup graph_concepts - /// @{ + /// \ingroup graph_concepts /// /// \brief Class describing the concept of Bipartite Undirected Graphs. /// @@ -998,9 +997,6 @@ }; - - /// @} - } } diff -r 51995c1f1093 -r 88aa7870756a lemon/concepts/graph.h --- a/lemon/concepts/graph.h Mon Oct 01 19:23:16 2007 +0000 +++ b/lemon/concepts/graph.h Tue Oct 02 12:34:43 2007 +0000 @@ -32,8 +32,7 @@ namespace lemon { namespace concepts { - /// \addtogroup graph_concepts - /// @{ + /// \ingroup graph_concepts /// /// \brief Class describing the concept of Directed Graphs. /// @@ -446,7 +445,6 @@ }; - // @} } //namespace concepts } //namespace lemon diff -r 51995c1f1093 -r 88aa7870756a lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Mon Oct 01 19:23:16 2007 +0000 +++ b/lemon/concepts/graph_components.h Tue Oct 02 12:34:43 2007 +0000 @@ -1482,15 +1482,12 @@ /// template class NodeMap : public GraphMap { - private: - NodeMap(); public: typedef GraphMap Parent; /// \brief Construct a new map. /// /// Construct a new map for the graph. - /// \todo call the right parent class constructor explicit NodeMap(const MappableGraphComponent& graph) : Parent(graph) {} @@ -1522,15 +1519,12 @@ /// template class EdgeMap : public GraphMap { - private: - EdgeMap(); public: typedef GraphMap Parent; /// \brief Construct a new map. /// /// Construct a new map for the graph. - /// \todo call the right parent class constructor explicit EdgeMap(const MappableGraphComponent& graph) : Parent(graph) {} @@ -1627,7 +1621,6 @@ /// \brief Construct a new map. /// /// Construct a new map for the graph. - /// \todo call the right parent class constructor explicit UEdgeMap(const MappableUGraphComponent& graph) : Parent(graph) {} @@ -1712,7 +1705,6 @@ /// \brief Construct a new map. /// /// Construct a new map for the graph. - /// \todo call the right parent class constructor explicit ANodeMap(const MappableBpUGraphComponent& graph) : Parent(graph) {} @@ -1750,7 +1742,6 @@ /// \brief Construct a new map. /// /// Construct a new map for the graph. - /// \todo call the right parent class constructor explicit BNodeMap(const MappableBpUGraphComponent& graph) : Parent(graph) {} diff -r 51995c1f1093 -r 88aa7870756a lemon/concepts/ugraph.h --- a/lemon/concepts/ugraph.h Mon Oct 01 19:23:16 2007 +0000 +++ b/lemon/concepts/ugraph.h Tue Oct 02 12:34:43 2007 +0000 @@ -30,8 +30,7 @@ namespace lemon { namespace concepts { - /// \addtogroup graph_concepts - /// @{ + /// \ingroup graph_concepts /// /// \brief Class describing the concept of Undirected Graphs. /// @@ -696,8 +695,6 @@ }; - /// @} - } } diff -r 51995c1f1093 -r 88aa7870756a lemon/graph_utils.h --- a/lemon/graph_utils.h Mon Oct 01 19:23:16 2007 +0000 +++ b/lemon/graph_utils.h Tue Oct 02 12:34:43 2007 +0000 @@ -146,8 +146,9 @@ /// The complexity of the function is O(n) but for some /// graph structures it is specialized to run in O(1). /// - /// \todo Refer how to specialize it. - + /// If the graph contains a \e nodeNum() member function and a + /// \e NodeNumTag tag then this function calls directly the member + /// function to query the cardinality of the node set. template inline int countNodes(const Graph& g) { return _graph_utils_bits::CountNodesSelector::count(g); @@ -179,8 +180,9 @@ /// The complexity of the function is O(an) but for some /// graph structures it is specialized to run in O(1). /// - /// \todo Refer how to specialize it. - + /// If the graph contains an \e aNodeNum() member function and a + /// \e NodeNumTag tag then this function calls directly the member + /// function to query the cardinality of the A-node set. template inline int countANodes(const Graph& g) { return _graph_utils_bits::CountANodesSelector::count(g); @@ -212,8 +214,9 @@ /// The complexity of the function is O(bn) but for some /// graph structures it is specialized to run in O(1). /// - /// \todo Refer how to specialize it. - + /// If the graph contains a \e bNodeNum() member function and a + /// \e NodeNumTag tag then this function calls directly the member + /// function to query the cardinality of the B-node set. template inline int countBNodes(const Graph& g) { return _graph_utils_bits::CountBNodesSelector::count(g); @@ -247,7 +250,10 @@ /// This function counts the edges in the graph. /// The complexity of the function is O(e) but for some /// graph structures it is specialized to run in O(1). - + /// + /// If the graph contains a \e edgeNum() member function and a + /// \e EdgeNumTag tag then this function calls directly the member + /// function to query the cardinality of the edge set. template inline int countEdges(const Graph& g) { return _graph_utils_bits::CountEdgesSelector::count(g); @@ -279,7 +285,10 @@ /// This function counts the undirected edges in the graph. /// The complexity of the function is O(e) but for some /// graph structures it is specialized to run in O(1). - + /// + /// If the graph contains a \e uEdgeNum() member function and a + /// \e EdgeNumTag tag then this function calls directly the member + /// function to query the cardinality of the undirected edge set. template inline int countUEdges(const Graph& g) { return _graph_utils_bits::CountUEdgesSelector::count(g); @@ -559,26 +568,26 @@ /// \brief Copy a map. /// - /// This function copies the \c source map to the \c target map. It uses the + /// This function copies the \c from map to the \c to map. It uses the /// given iterator to iterate on the data structure and it uses the \c ref - /// mapping to convert the source's keys to the target's keys. - template - void copyMap(Target& target, const Source& source, + void copyMap(To& to, const From& from, ItemIt it, const Ref& ref) { for (; it != INVALID; ++it) { - target[ref[it]] = source[it]; + to[ref[it]] = from[it]; } } - /// \brief Copy the source map to the target map. + /// \brief Copy the from map to the to map. /// - /// Copy the \c source map to the \c target map. It uses the given iterator + /// Copy the \c from map to the \c to map. It uses the given iterator /// to iterate on the data structure. - template - void copyMap(Target& target, const Source& source, ItemIt it) { + template + void copyMap(To& to, const From& from, ItemIt it) { for (; it != INVALID; ++it) { - target[it] = source[it]; + to[it] = from[it]; } } @@ -587,17 +596,17 @@ template class MapCopyBase { public: - virtual void copy(const Graph& source, const RefMap& refMap) = 0; + virtual void copy(const Graph& from, const RefMap& refMap) = 0; virtual ~MapCopyBase() {} }; template + typename ToMap, typename FromMap> class MapCopy : public MapCopyBase { public: - MapCopy(TargetMap& tmap, const SourceMap& map) + MapCopy(ToMap& tmap, const FromMap& map) : _tmap(tmap), _map(map) {} virtual void copy(const Graph& graph, const RefMap& refMap) { @@ -608,8 +617,8 @@ } private: - TargetMap& _tmap; - const SourceMap& _map; + ToMap& _tmap; + const FromMap& _map; }; template @@ -664,15 +673,15 @@ template struct GraphCopySelector { - template - static void copy(Graph &target, const Source& source, + template + static void copy(Graph &to, const From& from, NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) { - for (typename Source::NodeIt it(source); it != INVALID; ++it) { - nodeRefMap[it] = target.addNode(); + for (typename From::NodeIt it(from); it != INVALID; ++it) { + nodeRefMap[it] = to.addNode(); } - for (typename Source::EdgeIt it(source); it != INVALID; ++it) { - edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], - nodeRefMap[source.target(it)]); + for (typename From::EdgeIt it(from); it != INVALID; ++it) { + edgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)], + nodeRefMap[from.target(it)]); } } }; @@ -682,24 +691,24 @@ Graph, typename enable_if::type> { - template - static void copy(Graph &target, const Source& source, + template + static void copy(Graph &to, const From& from, NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) { - target.build(source, nodeRefMap, edgeRefMap); + to.build(from, nodeRefMap, edgeRefMap); } }; template struct UGraphCopySelector { - template - static void copy(UGraph &target, const Source& source, + template + static void copy(UGraph &to, const From& from, NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) { - for (typename Source::NodeIt it(source); it != INVALID; ++it) { - nodeRefMap[it] = target.addNode(); + for (typename From::NodeIt it(from); it != INVALID; ++it) { + nodeRefMap[it] = to.addNode(); } - for (typename Source::UEdgeIt it(source); it != INVALID; ++it) { - uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], - nodeRefMap[source.target(it)]); + for (typename From::UEdgeIt it(from); it != INVALID; ++it) { + uEdgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)], + nodeRefMap[from.target(it)]); } } }; @@ -709,29 +718,29 @@ UGraph, typename enable_if::type> { - template - static void copy(UGraph &target, const Source& source, + template + static void copy(UGraph &to, const From& from, NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) { - target.build(source, nodeRefMap, uEdgeRefMap); + to.build(from, nodeRefMap, uEdgeRefMap); } }; template struct BpUGraphCopySelector { - template - static void copy(BpUGraph &target, const Source& source, + static void copy(BpUGraph &to, const From& from, ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap, UEdgeRefMap& uEdgeRefMap) { - for (typename Source::ANodeIt it(source); it != INVALID; ++it) { - aNodeRefMap[it] = target.addANode(); + for (typename From::ANodeIt it(from); it != INVALID; ++it) { + aNodeRefMap[it] = to.addANode(); } - for (typename Source::BNodeIt it(source); it != INVALID; ++it) { - bNodeRefMap[it] = target.addBNode(); + for (typename From::BNodeIt it(from); it != INVALID; ++it) { + bNodeRefMap[it] = to.addBNode(); } - for (typename Source::UEdgeIt it(source); it != INVALID; ++it) { - uEdgeRefMap[it] = target.addEdge(aNodeRefMap[source.aNode(it)], - bNodeRefMap[source.bNode(it)]); + for (typename From::UEdgeIt it(from); it != INVALID; ++it) { + uEdgeRefMap[it] = to.addEdge(aNodeRefMap[from.aNode(it)], + bNodeRefMap[from.bNode(it)]); } } }; @@ -741,12 +750,12 @@ BpUGraph, typename enable_if::type> { - template - static void copy(BpUGraph &target, const Source& source, + static void copy(BpUGraph &to, const From& from, ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap, UEdgeRefMap& uEdgeRefMap) { - target.build(source, aNodeRefMap, bNodeRefMap, uEdgeRefMap); + to.build(from, aNodeRefMap, bNodeRefMap, uEdgeRefMap); } }; @@ -757,20 +766,20 @@ /// /// Class to copy a graph to another graph (duplicate a graph). The /// simplest way of using it is through the \c copyGraph() function. - template + template class GraphCopy { private: - typedef typename Source::Node Node; - typedef typename Source::NodeIt NodeIt; - typedef typename Source::Edge Edge; - typedef typename Source::EdgeIt EdgeIt; + typedef typename From::Node Node; + typedef typename From::NodeIt NodeIt; + typedef typename From::Edge Edge; + typedef typename From::EdgeIt EdgeIt; - typedef typename Target::Node TNode; - typedef typename Target::Edge TEdge; + typedef typename To::Node TNode; + typedef typename To::Edge TEdge; - typedef typename Source::template NodeMap NodeRefMap; - typedef typename Source::template EdgeMap EdgeRefMap; + typedef typename From::template NodeMap NodeRefMap; + typedef typename From::template EdgeMap EdgeRefMap; public: @@ -778,10 +787,10 @@ /// \brief Constructor for the GraphCopy. /// - /// It copies the content of the \c _source graph into the - /// \c _target graph. - GraphCopy(Target& _target, const Source& _source) - : source(_source), target(_target) {} + /// It copies the content of the \c _from graph into the + /// \c _to graph. + GraphCopy(To& _to, const From& _from) + : from(_from), to(_to) {} /// \brief Destructor of the GraphCopy /// @@ -801,7 +810,7 @@ /// Copies the node references into the given map. template GraphCopy& nodeRef(NodeRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -812,7 +821,7 @@ /// the given map. template GraphCopy& nodeCrossRef(NodeCrossRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -820,13 +829,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's node type, - /// and the copied map's key type is the source graph's node + /// The new map's key type is the to graph's node type, + /// and the copied map's key type is the from graph's node /// type. - template - GraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) { - nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + GraphCopy& nodeMap(ToMap& tmap, const FromMap& map) { + nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -834,7 +843,7 @@ /// /// Make a copy of the given node. GraphCopy& node(TNode& tnode, const Node& snode) { - nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tnode, snode)); return *this; } @@ -844,7 +853,7 @@ /// Copies the edge references into the given map. template GraphCopy& edgeRef(EdgeRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -855,7 +864,7 @@ /// the given map. template GraphCopy& edgeCrossRef(EdgeCrossRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -863,13 +872,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's edge type, - /// and the copied map's key type is the source graph's edge + /// The new map's key type is the to graph's edge type, + /// and the copied map's key type is the from graph's edge /// type. - template - GraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) { - edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + GraphCopy& edgeMap(ToMap& tmap, const FromMap& map) { + edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -877,7 +886,7 @@ /// /// Make a copy of the given edge. GraphCopy& edge(TEdge& tedge, const Edge& sedge) { - edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tedge, sedge)); return *this; } @@ -886,28 +895,28 @@ /// /// Executes the copies. void run() { - NodeRefMap nodeRefMap(source); - EdgeRefMap edgeRefMap(source); - _graph_utils_bits::GraphCopySelector:: - copy(target, source, nodeRefMap, edgeRefMap); + NodeRefMap nodeRefMap(from); + EdgeRefMap edgeRefMap(from); + _graph_utils_bits::GraphCopySelector:: + copy(to, from, nodeRefMap, edgeRefMap); for (int i = 0; i < int(nodeMapCopies.size()); ++i) { - nodeMapCopies[i]->copy(source, nodeRefMap); + nodeMapCopies[i]->copy(from, nodeRefMap); } for (int i = 0; i < int(edgeMapCopies.size()); ++i) { - edgeMapCopies[i]->copy(source, edgeRefMap); + edgeMapCopies[i]->copy(from, edgeRefMap); } } protected: - const Source& source; - Target& target; + const From& from; + To& to; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > nodeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > edgeMapCopies; }; @@ -922,57 +931,57 @@ ///\endcode /// /// After the copy the \c nr map will contain the mapping from the - /// source graph's nodes to the target graph's nodes and the \c ecr will - /// contain the mapping from the target graph's edges to the source's + /// from graph's nodes to the to graph's nodes and the \c ecr will + /// contain the mapping from the to graph's edges to the from's /// edges. /// /// \see GraphCopy - template - GraphCopy copyGraph(Target& target, const Source& source) { - return GraphCopy(target, source); + template + GraphCopy copyGraph(To& to, const From& from) { + return GraphCopy(to, from); } /// \brief Class to copy an undirected graph. /// /// Class to copy an undirected graph to another graph (duplicate a graph). /// The simplest way of using it is through the \c copyUGraph() function. - template + template class UGraphCopy { private: - typedef typename Source::Node Node; - typedef typename Source::NodeIt NodeIt; - typedef typename Source::Edge Edge; - typedef typename Source::EdgeIt EdgeIt; - typedef typename Source::UEdge UEdge; - typedef typename Source::UEdgeIt UEdgeIt; + typedef typename From::Node Node; + typedef typename From::NodeIt NodeIt; + typedef typename From::Edge Edge; + typedef typename From::EdgeIt EdgeIt; + typedef typename From::UEdge UEdge; + typedef typename From::UEdgeIt UEdgeIt; - typedef typename Target::Node TNode; - typedef typename Target::Edge TEdge; - typedef typename Target::UEdge TUEdge; + typedef typename To::Node TNode; + typedef typename To::Edge TEdge; + typedef typename To::UEdge TUEdge; - typedef typename Source::template NodeMap NodeRefMap; - typedef typename Source::template UEdgeMap UEdgeRefMap; + typedef typename From::template NodeMap NodeRefMap; + typedef typename From::template UEdgeMap UEdgeRefMap; struct EdgeRefMap { - EdgeRefMap(const Target& _target, const Source& _source, + EdgeRefMap(const To& _to, const From& _from, const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref) - : target(_target), source(_source), + : to(_to), from(_from), uedge_ref(_uedge_ref), node_ref(_node_ref) {} - typedef typename Source::Edge Key; - typedef typename Target::Edge Value; + typedef typename From::Edge Key; + typedef typename To::Edge Value; Value operator[](const Key& key) const { bool forward = - (source.direction(key) == - (node_ref[source.source(static_cast(key))] == - target.source(uedge_ref[static_cast(key)]))); - return target.direct(uedge_ref[key], forward); + (from.direction(key) == + (node_ref[from.source(static_cast(key))] == + to.source(uedge_ref[static_cast(key)]))); + return to.direct(uedge_ref[key], forward); } - const Target& target; - const Source& source; + const To& to; + const From& from; const UEdgeRefMap& uedge_ref; const NodeRefMap& node_ref; }; @@ -983,10 +992,10 @@ /// \brief Constructor for the GraphCopy. /// - /// It copies the content of the \c _source graph into the - /// \c _target graph. - UGraphCopy(Target& _target, const Source& _source) - : source(_source), target(_target) {} + /// It copies the content of the \c _from graph into the + /// \c _to graph. + UGraphCopy(To& _to, const From& _from) + : from(_from), to(_to) {} /// \brief Destructor of the GraphCopy /// @@ -1009,7 +1018,7 @@ /// Copies the node references into the given map. template UGraphCopy& nodeRef(NodeRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1020,7 +1029,7 @@ /// the given map. template UGraphCopy& nodeCrossRef(NodeCrossRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1028,13 +1037,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's node type, - /// and the copied map's key type is the source graph's node + /// The new map's key type is the to graph's node type, + /// and the copied map's key type is the from graph's node /// type. - template - UGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) { - nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + UGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) { + nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1042,7 +1051,7 @@ /// /// Make a copy of the given node. UGraphCopy& node(TNode& tnode, const Node& snode) { - nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tnode, snode)); return *this; } @@ -1052,7 +1061,7 @@ /// Copies the edge references into the given map. template UGraphCopy& edgeRef(EdgeRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1063,7 +1072,7 @@ /// the given map. template UGraphCopy& edgeCrossRef(EdgeCrossRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1071,13 +1080,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's edge type, - /// and the copied map's key type is the source graph's edge + /// The new map's key type is the to graph's edge type, + /// and the copied map's key type is the from graph's edge /// type. - template - UGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) { - edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + UGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) { + edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1085,7 +1094,7 @@ /// /// Make a copy of the given edge. UGraphCopy& edge(TEdge& tedge, const Edge& sedge) { - edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tedge, sedge)); return *this; } @@ -1095,7 +1104,7 @@ /// Copies the undirected edge references into the given map. template UGraphCopy& uEdgeRef(UEdgeRef& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1106,7 +1115,7 @@ /// references) into the given map. template UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1114,13 +1123,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's undirected edge type, - /// and the copied map's key type is the source graph's undirected edge + /// The new map's key type is the to graph's undirected edge type, + /// and the copied map's key type is the from graph's undirected edge /// type. - template - UGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + UGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) { + uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1128,7 +1137,7 @@ /// /// Make a copy of the given undirected edge. UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) { - uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tuedge, suedge)); return *this; } @@ -1137,34 +1146,34 @@ /// /// Executes the copies. void run() { - NodeRefMap nodeRefMap(source); - UEdgeRefMap uEdgeRefMap(source); - EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); - _graph_utils_bits::UGraphCopySelector:: - copy(target, source, nodeRefMap, uEdgeRefMap); + NodeRefMap nodeRefMap(from); + UEdgeRefMap uEdgeRefMap(from); + EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap); + _graph_utils_bits::UGraphCopySelector:: + copy(to, from, nodeRefMap, uEdgeRefMap); for (int i = 0; i < int(nodeMapCopies.size()); ++i) { - nodeMapCopies[i]->copy(source, nodeRefMap); + nodeMapCopies[i]->copy(from, nodeRefMap); } for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { - uEdgeMapCopies[i]->copy(source, uEdgeRefMap); + uEdgeMapCopies[i]->copy(from, uEdgeRefMap); } for (int i = 0; i < int(edgeMapCopies.size()); ++i) { - edgeMapCopies[i]->copy(source, edgeRefMap); + edgeMapCopies[i]->copy(from, edgeRefMap); } } private: - const Source& source; - Target& target; + const From& from; + To& to; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > nodeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > edgeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > uEdgeMapCopies; }; @@ -1179,15 +1188,15 @@ ///\endcode /// /// After the copy the \c nr map will contain the mapping from the - /// source graph's nodes to the target graph's nodes and the \c ecr will - /// contain the mapping from the target graph's edges to the source's + /// from graph's nodes to the to graph's nodes and the \c ecr will + /// contain the mapping from the to graph's edges to the from's /// edges. /// /// \see UGraphCopy - template - UGraphCopy - copyUGraph(Target& target, const Source& source) { - return UGraphCopy(target, source); + template + UGraphCopy + copyUGraph(To& to, const From& from) { + return UGraphCopy(to, from); } /// \brief Class to copy a bipartite undirected graph. @@ -1195,63 +1204,63 @@ /// Class to copy a bipartite undirected graph to another graph /// (duplicate a graph). The simplest way of using it is through /// the \c copyBpUGraph() function. - template + template class BpUGraphCopy { private: - typedef typename Source::Node Node; - typedef typename Source::ANode ANode; - typedef typename Source::BNode BNode; - typedef typename Source::NodeIt NodeIt; - typedef typename Source::Edge Edge; - typedef typename Source::EdgeIt EdgeIt; - typedef typename Source::UEdge UEdge; - typedef typename Source::UEdgeIt UEdgeIt; + typedef typename From::Node Node; + typedef typename From::ANode ANode; + typedef typename From::BNode BNode; + typedef typename From::NodeIt NodeIt; + typedef typename From::Edge Edge; + typedef typename From::EdgeIt EdgeIt; + typedef typename From::UEdge UEdge; + typedef typename From::UEdgeIt UEdgeIt; - typedef typename Target::Node TNode; - typedef typename Target::Edge TEdge; - typedef typename Target::UEdge TUEdge; + typedef typename To::Node TNode; + typedef typename To::Edge TEdge; + typedef typename To::UEdge TUEdge; - typedef typename Source::template ANodeMap ANodeRefMap; - typedef typename Source::template BNodeMap BNodeRefMap; - typedef typename Source::template UEdgeMap UEdgeRefMap; + typedef typename From::template ANodeMap ANodeRefMap; + typedef typename From::template BNodeMap BNodeRefMap; + typedef typename From::template UEdgeMap UEdgeRefMap; struct NodeRefMap { - NodeRefMap(const Source& _source, const ANodeRefMap& _anode_ref, + NodeRefMap(const From& _from, const ANodeRefMap& _anode_ref, const BNodeRefMap& _bnode_ref) - : source(_source), anode_ref(_anode_ref), bnode_ref(_bnode_ref) {} + : from(_from), anode_ref(_anode_ref), bnode_ref(_bnode_ref) {} - typedef typename Source::Node Key; - typedef typename Target::Node Value; + typedef typename From::Node Key; + typedef typename To::Node Value; Value operator[](const Key& key) const { - return source.aNode(key) ? anode_ref[key] : bnode_ref[key]; + return from.aNode(key) ? anode_ref[key] : bnode_ref[key]; } - const Source& source; + const From& from; const ANodeRefMap& anode_ref; const BNodeRefMap& bnode_ref; }; struct EdgeRefMap { - EdgeRefMap(const Target& _target, const Source& _source, + EdgeRefMap(const To& _to, const From& _from, const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref) - : target(_target), source(_source), + : to(_to), from(_from), uedge_ref(_uedge_ref), node_ref(_node_ref) {} - typedef typename Source::Edge Key; - typedef typename Target::Edge Value; + typedef typename From::Edge Key; + typedef typename To::Edge Value; Value operator[](const Key& key) const { bool forward = - (source.direction(key) == - (node_ref[source.source(static_cast(key))] == - target.source(uedge_ref[static_cast(key)]))); - return target.direct(uedge_ref[key], forward); + (from.direction(key) == + (node_ref[from.source(static_cast(key))] == + to.source(uedge_ref[static_cast(key)]))); + return to.direct(uedge_ref[key], forward); } - const Target& target; - const Source& source; + const To& to; + const From& from; const UEdgeRefMap& uedge_ref; const NodeRefMap& node_ref; }; @@ -1261,10 +1270,10 @@ /// \brief Constructor for the GraphCopy. /// - /// It copies the content of the \c _source graph into the - /// \c _target graph. - BpUGraphCopy(Target& _target, const Source& _source) - : source(_source), target(_target) {} + /// It copies the content of the \c _from graph into the + /// \c _to graph. + BpUGraphCopy(To& _to, const From& _from) + : from(_from), to(_to) {} /// \brief Destructor of the GraphCopy /// @@ -1293,7 +1302,7 @@ /// Copies the A-node references into the given map. template BpUGraphCopy& aNodeRef(ANodeRef& map) { - aNodeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1304,7 +1313,7 @@ /// the given map. template BpUGraphCopy& aNodeCrossRef(ANodeCrossRef& map) { - aNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1312,13 +1321,13 @@ /// \brief Make copy of the given A-node map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's node type, - /// and the copied map's key type is the source graph's node + /// The new map's key type is the to graph's node type, + /// and the copied map's key type is the from graph's node /// type. - template - BpUGraphCopy& aNodeMap(TargetMap& tmap, const SourceMap& map) { - aNodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + BpUGraphCopy& aNodeMap(ToMap& tmap, const FromMap& map) { + aNodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1327,7 +1336,7 @@ /// Copies the B-node references into the given map. template BpUGraphCopy& bNodeRef(BNodeRef& map) { - bNodeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1338,7 +1347,7 @@ /// the given map. template BpUGraphCopy& bNodeCrossRef(BNodeCrossRef& map) { - bNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1346,13 +1355,13 @@ /// \brief Make copy of the given B-node map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's node type, - /// and the copied map's key type is the source graph's node + /// The new map's key type is the to graph's node type, + /// and the copied map's key type is the from graph's node /// type. - template - BpUGraphCopy& bNodeMap(TargetMap& tmap, const SourceMap& map) { - bNodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + BpUGraphCopy& bNodeMap(ToMap& tmap, const FromMap& map) { + bNodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } /// \brief Copies the node references into the given map. @@ -1360,7 +1369,7 @@ /// Copies the node references into the given map. template BpUGraphCopy& nodeRef(NodeRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1371,7 +1380,7 @@ /// the given map. template BpUGraphCopy& nodeCrossRef(NodeCrossRef& map) { - nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1379,13 +1388,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's node type, - /// and the copied map's key type is the source graph's node + /// The new map's key type is the to graph's node type, + /// and the copied map's key type is the from graph's node /// type. - template - BpUGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) { - nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + BpUGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) { + nodeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1393,7 +1402,7 @@ /// /// Make a copy of the given node. BpUGraphCopy& node(TNode& tnode, const Node& snode) { - nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tnode, snode)); return *this; } @@ -1403,7 +1412,7 @@ /// Copies the edge references into the given map. template BpUGraphCopy& edgeRef(EdgeRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1414,7 +1423,7 @@ /// the given map. template BpUGraphCopy& edgeCrossRef(EdgeCrossRef& map) { - edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1422,13 +1431,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's edge type, - /// and the copied map's key type is the source graph's edge + /// The new map's key type is the to graph's edge type, + /// and the copied map's key type is the from graph's edge /// type. - template - BpUGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) { - edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + BpUGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) { + edgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1436,7 +1445,7 @@ /// /// Make a copy of the given edge. BpUGraphCopy& edge(TEdge& tedge, const Edge& sedge) { - edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tedge, sedge)); return *this; } @@ -1446,7 +1455,7 @@ /// Copies the undirected edge references into the given map. template BpUGraphCopy& uEdgeRef(UEdgeRef& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy(map)); return *this; } @@ -1457,7 +1466,7 @@ /// references) into the given map. template BpUGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy(map)); return *this; } @@ -1465,13 +1474,13 @@ /// \brief Make copy of the given map. /// /// Makes copy of the given map for the newly created graph. - /// The new map's key type is the target graph's undirected edge type, - /// and the copied map's key type is the source graph's undirected edge + /// The new map's key type is the to graph's undirected edge type, + /// and the copied map's key type is the from graph's undirected edge /// type. - template - BpUGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) { - uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); + template + BpUGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) { + uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy(tmap, map)); return *this; } @@ -1479,7 +1488,7 @@ /// /// Make a copy of the given undirected edge. BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) { - uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy(tuedge, suedge)); return *this; } @@ -1488,48 +1497,48 @@ /// /// Executes the copies. void run() { - ANodeRefMap aNodeRefMap(source); - BNodeRefMap bNodeRefMap(source); - NodeRefMap nodeRefMap(source, aNodeRefMap, bNodeRefMap); - UEdgeRefMap uEdgeRefMap(source); - EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); - _graph_utils_bits::BpUGraphCopySelector:: - copy(target, source, aNodeRefMap, bNodeRefMap, uEdgeRefMap); + ANodeRefMap aNodeRefMap(from); + BNodeRefMap bNodeRefMap(from); + NodeRefMap nodeRefMap(from, aNodeRefMap, bNodeRefMap); + UEdgeRefMap uEdgeRefMap(from); + EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap); + _graph_utils_bits::BpUGraphCopySelector:: + copy(to, from, aNodeRefMap, bNodeRefMap, uEdgeRefMap); for (int i = 0; i < int(aNodeMapCopies.size()); ++i) { - aNodeMapCopies[i]->copy(source, aNodeRefMap); + aNodeMapCopies[i]->copy(from, aNodeRefMap); } for (int i = 0; i < int(bNodeMapCopies.size()); ++i) { - bNodeMapCopies[i]->copy(source, bNodeRefMap); + bNodeMapCopies[i]->copy(from, bNodeRefMap); } for (int i = 0; i < int(nodeMapCopies.size()); ++i) { - nodeMapCopies[i]->copy(source, nodeRefMap); + nodeMapCopies[i]->copy(from, nodeRefMap); } for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { - uEdgeMapCopies[i]->copy(source, uEdgeRefMap); + uEdgeMapCopies[i]->copy(from, uEdgeRefMap); } for (int i = 0; i < int(edgeMapCopies.size()); ++i) { - edgeMapCopies[i]->copy(source, edgeRefMap); + edgeMapCopies[i]->copy(from, edgeRefMap); } } private: - const Source& source; - Target& target; + const From& from; + To& to; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > aNodeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > bNodeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > nodeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > edgeMapCopies; - std::vector<_graph_utils_bits::MapCopyBase* > + std::vector<_graph_utils_bits::MapCopyBase* > uEdgeMapCopies; }; @@ -1544,15 +1553,15 @@ ///\endcode /// /// After the copy the \c nr map will contain the mapping from the - /// source graph's nodes to the target graph's nodes and the \c ecr will - /// contain the mapping from the target graph's edges to the source's + /// from graph's nodes to the to graph's nodes and the \c ecr will + /// contain the mapping from the to graph's edges to the from's /// edges. /// /// \see BpUGraphCopy - template - BpUGraphCopy - copyBpUGraph(Target& target, const Source& source) { - return BpUGraphCopy(target, source); + template + BpUGraphCopy + copyBpUGraph(To& to, const From& from) { + return BpUGraphCopy(to, from); }