[Lemon-commits] [lemon_svn] deba: r3051 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:52:04 CET 2006
Author: deba
Date: Tue Oct 31 15:41:12 2006
New Revision: 3051
Modified:
hugo/trunk/lemon/graph_utils.h
Log:
The implementation of the graph copy is changed
Make explicit more constructors
Modified: hugo/trunk/lemon/graph_utils.h
==============================================================================
--- hugo/trunk/lemon/graph_utils.h (original)
+++ hugo/trunk/lemon/graph_utils.h Tue Oct 31 15:41:12 2006
@@ -83,9 +83,6 @@
typedef Graph:: UEdge UEdge; \
typedef Graph:: UEdgeIt UEdgeIt; \
typedef Graph:: IncEdgeIt IncEdgeIt;
-// typedef Graph::template UEdgeMap<bool> BoolUEdgeMap;
-// typedef Graph::template UEdgeMap<int> IntUEdgeMap;
-// typedef Graph::template UEdgeMap<double> DoubleUEdgeMap;
///\brief Creates convenience typedefs for the bipartite undirected graph
///types and iterators
@@ -103,6 +100,8 @@
///template typedefs in C++.
#define BPUGRAPH_TYPEDEFS(Graph) \
UGRAPH_TYPEDEFS(Graph) \
+ typedef Graph::ANode ANode; \
+ typedef Graph::BNode BNode; \
typedef Graph::ANodeIt ANodeIt; \
typedef Graph::BNodeIt BNodeIt;
@@ -379,10 +378,9 @@
///\se AllEdgeLookup
///\sa ConEdgeIt
template <typename Graph>
- inline typename Graph::Edge findEdge(const Graph &g,
- typename Graph::Node u,
- typename Graph::Node v,
- typename Graph::Edge prev = INVALID) {
+ inline typename Graph::Edge
+ findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+ typename Graph::Edge prev = INVALID) {
return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, prev);
}
@@ -506,10 +504,9 @@
///\sa ConEdgeIt
template <typename Graph>
- inline typename Graph::UEdge findUEdge(const Graph &g,
- typename Graph::Node u,
- typename Graph::Node v,
- typename Graph::UEdge p = INVALID) {
+ inline typename Graph::UEdge
+ findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+ typename Graph::UEdge p = INVALID) {
return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, p);
}
@@ -588,91 +585,166 @@
}
}
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Item, typename RefMap>
+ class MapCopyBase {
+ public:
+ virtual void copy(const Graph& source, const RefMap& refMap) = 0;
+
+ virtual ~MapCopyBase() {}
+ };
+
+ template <typename Graph, typename Item, typename RefMap,
+ typename TargetMap, typename SourceMap>
+ class MapCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ MapCopy(TargetMap& tmap, const SourceMap& map)
+ : _tmap(tmap), _map(map) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _tmap.set(refMap[it], _map[it]);
+ }
+ }
+
+ private:
+ TargetMap& _tmap;
+ const SourceMap& _map;
+ };
+
+ template <typename Graph, typename Item, typename RefMap, typename Ref>
+ class RefCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ RefCopy(Ref& map) : _map(map) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _map.set(it, refMap[it]);
+ }
+ }
+
+ private:
+ Ref& _map;
+ };
+
+ template <typename Graph, typename Item, typename RefMap,
+ typename CrossRef>
+ class CrossRefCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ CrossRefCopy(CrossRef& cmap) : _cmap(cmap) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _cmap.set(refMap[it], it);
+ }
+ }
+
+ private:
+ CrossRef& _cmap;
+ };
+
+ }
+
/// \brief Class to copy a graph.
///
/// Class to copy a graph to another graph (duplicate a graph). The
/// simplest way of using it is through the \c copyGraph() function.
template <typename Target, typename Source>
class GraphCopy {
- public:
+ private:
+
typedef typename Source::Node Node;
typedef typename Source::NodeIt NodeIt;
typedef typename Source::Edge Edge;
typedef typename Source::EdgeIt EdgeIt;
- typedef typename Source::template NodeMap<typename Target::Node>NodeRefMap;
- typedef typename Source::template EdgeMap<typename Target::Edge>EdgeRefMap;
+ typedef typename Target::Node TNode;
+ typedef typename Target::Edge TEdge;
+
+ typedef typename Source::template NodeMap<TNode> NodeRefMap;
+ typedef typename Source::template EdgeMap<TEdge> EdgeRefMap;
+
+
+ public:
+
/// \brief Constructor for the GraphCopy.
///
/// It copies the content of the \c _source graph into the
- /// \c _target graph. It creates also two references, one beetween
- /// the two nodeset and one beetween the two edgesets.
+ /// \c _target graph.
GraphCopy(Target& _target, const Source& _source)
- : source(_source), target(_target),
- nodeRefMap(_source), edgeRefMap(_source) {
- for (NodeIt it(source); it != INVALID; ++it) {
- nodeRefMap[it] = target.addNode();
+ : source(_source), target(_target) {}
+
+ /// \brief Destructor of the GraphCopy
+ ///
+ /// Destructor of the GraphCopy
+ ~GraphCopy() {
+ for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ delete nodeMapCopies[i];
}
- for (EdgeIt it(source); it != INVALID; ++it) {
- edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
- nodeRefMap[source.target(it)]);
+ for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ delete edgeMapCopies[i];
}
+
}
/// \brief Copies the node references into the given map.
///
/// Copies the node references into the given map.
template <typename NodeRef>
- const GraphCopy& nodeRef(NodeRef& map) const {
- for (NodeIt it(source); it != INVALID; ++it) {
- map.set(it, nodeRefMap[it]);
- }
+ GraphCopy& nodeRef(NodeRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node,
+ NodeRefMap, NodeRef>(map));
return *this;
}
/// \brief Reverse and copies the node references into the given map.
///
/// Reverse and copies the node references into the given map.
- template <typename NodeRef>
- const GraphCopy& nodeCrossRef(NodeRef& map) const {
- for (NodeIt it(source); it != INVALID; ++it) {
- map.set(nodeRefMap[it], it);
- }
+ template <typename NodeCrossRef>
+ GraphCopy& nodeCrossRef(NodeCrossRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
+ NodeRefMap, NodeCrossRef>(map));
return *this;
}
- /// \brief Copies the edge references into the given map.
+ /// \brief Make copy of the given map.
///
- /// Copies the edge references into the given map.
- template <typename EdgeRef>
- const GraphCopy& edgeRef(EdgeRef& map) const {
- for (EdgeIt it(source); it != INVALID; ++it) {
- map.set(it, edgeRefMap[it]);
- }
+ /// 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
+ /// type.
+ template <typename TargetMap, typename SourceMap>
+ GraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node,
+ NodeRefMap, TargetMap, SourceMap>(tmap, map));
return *this;
}
- /// \brief Reverse and copies the edge references into the given map.
+ /// \brief Copies the edge references into the given map.
///
- /// Reverse and copies the edge references into the given map.
+ /// Copies the edge references into the given map.
template <typename EdgeRef>
- const GraphCopy& edgeCrossRef(EdgeRef& map) const {
- for (EdgeIt it(source); it != INVALID; ++it) {
- map.set(edgeRefMap[it], it);
- }
+ GraphCopy& edgeRef(EdgeRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge,
+ EdgeRefMap, EdgeRef>(map));
return *this;
}
- /// \brief Make copy of the given map.
+ /// \brief Reverse and copies the edge references into 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
- /// type.
- template <typename TargetMap, typename SourceMap>
- const GraphCopy& nodeMap(TargetMap& tMap, const SourceMap& sMap) const {
- copyMap(tMap, sMap, NodeIt(source), nodeRefMap);
+ /// Reverse and copies the edge references into the given map.
+ template <typename EdgeCrossRef>
+ GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
+ EdgeRefMap, EdgeCrossRef>(map));
return *this;
}
@@ -683,34 +755,44 @@
/// and the copied map's key type is the source graph's edge
/// type.
template <typename TargetMap, typename SourceMap>
- const GraphCopy& edgeMap(TargetMap& tMap, const SourceMap& sMap) const {
- copyMap(tMap, sMap, EdgeIt(source), edgeRefMap);
+ GraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge,
+ EdgeRefMap, TargetMap, SourceMap>(tmap, map));
return *this;
}
- /// \brief Gives back the stored node references.
+ /// \brief Executes the copies.
///
- /// Gives back the stored node references.
- const NodeRefMap& nodeRef() const {
- return nodeRefMap;
- }
-
- /// \brief Gives back the stored edge references.
- ///
- /// Gives back the stored edge references.
- const EdgeRefMap& edgeRef() const {
- return edgeRefMap;
+ /// Executes the copies.
+ void run() {
+ NodeRefMap nodeRefMap(source);
+ for (NodeIt it(source); it != INVALID; ++it) {
+ nodeRefMap[it] = target.addNode();
+ }
+ for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ nodeMapCopies[i]->copy(source, nodeRefMap);
+ }
+ EdgeRefMap edgeRefMap(source);
+ for (EdgeIt it(source); it != INVALID; ++it) {
+ edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
+ nodeRefMap[source.target(it)]);
+ }
+ for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ edgeMapCopies[i]->copy(source, edgeRefMap);
+ }
}
- void run() const {}
-
private:
const Source& source;
Target& target;
- NodeRefMap nodeRefMap;
- EdgeRefMap edgeRefMap;
+ std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* >
+ nodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* >
+ edgeMapCopies;
+
};
/// \brief Copy a graph to another graph.
@@ -719,7 +801,7 @@
/// The usage of the function:
///
///\code
- /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr);
+ /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
///\endcode
///
/// After the copy the \c nr map will contain the mapping from the
@@ -737,7 +819,8 @@
/// The simplest way of using it is through the \c copyUGraph() function.
template <typename Target, typename Source>
class UGraphCopy {
- public:
+ private:
+
typedef typename Source::Node Node;
typedef typename Source::NodeIt NodeIt;
typedef typename Source::Edge Edge;
@@ -745,124 +828,112 @@
typedef typename Source::UEdge UEdge;
typedef typename Source::UEdgeIt UEdgeIt;
- typedef typename Source::
- template NodeMap<typename Target::Node> NodeRefMap;
-
- typedef typename Source::
- template UEdgeMap<typename Target::UEdge> UEdgeRefMap;
+ typedef typename Target::Node TNode;
+ typedef typename Target::Edge TEdge;
+ typedef typename Target::UEdge TUEdge;
- private:
+ typedef typename Source::template NodeMap<TNode> NodeRefMap;
+ typedef typename Source::template UEdgeMap<TUEdge> UEdgeRefMap;
struct EdgeRefMap {
- EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {}
+ EdgeRefMap(const Target& _target, const Source& _source,
+ const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref)
+ : target(_target), source(_source),
+ uedge_ref(_uedge_ref), node_ref(_node_ref) {}
+
typedef typename Source::Edge Key;
typedef typename Target::Edge Value;
- Value operator[](const Key& key) {
- return gc.target.direct(gc.uEdgeRef[key],
- gc.target.direction(key));
+ Value operator[](const Key& key) const {
+ bool forward = (source.direction(key) ==
+ (node_ref[source.source((UEdge)key)] ==
+ target.source(uedge_ref[(UEdge)key])));
+ return target.direct(uedge_ref[key], forward);
}
- UGraphCopy& gc;
+ const Target& target;
+ const Source& source;
+ const UEdgeRefMap& uedge_ref;
+ const NodeRefMap& node_ref;
};
+
- public:
+ public:
+
- /// \brief Constructor for the UGraphCopy.
+ /// \brief Constructor for the GraphCopy.
///
/// It copies the content of the \c _source graph into the
- /// \c _target graph. It creates also two references, one beetween
- /// the two nodeset and one beetween the two edgesets.
+ /// \c _target graph.
UGraphCopy(Target& _target, const Source& _source)
- : source(_source), target(_target),
- nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) {
- for (NodeIt it(source); it != INVALID; ++it) {
- nodeRefMap[it] = target.addNode();
+ : source(_source), target(_target) {}
+
+ /// \brief Destructor of the GraphCopy
+ ///
+ /// Destructor of the GraphCopy
+ ~UGraphCopy() {
+ for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ delete nodeMapCopies[i];
}
- for (UEdgeIt it(source); it != INVALID; ++it) {
- uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
- nodeRefMap[source.target(it)]);
+ for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ delete edgeMapCopies[i];
+ }
+ for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ delete uEdgeMapCopies[i];
}
+
}
/// \brief Copies the node references into the given map.
///
/// Copies the node references into the given map.
template <typename NodeRef>
- const UGraphCopy& nodeRef(NodeRef& map) const {
- for (NodeIt it(source); it != INVALID; ++it) {
- map.set(it, nodeRefMap[it]);
- }
+ UGraphCopy& nodeRef(NodeRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node,
+ NodeRefMap, NodeRef>(map));
return *this;
}
/// \brief Reverse and copies the node references into the given map.
///
/// Reverse and copies the node references into the given map.
- template <typename NodeRef>
- const UGraphCopy& nodeCrossRef(NodeRef& map) const {
- for (NodeIt it(source); it != INVALID; ++it) {
- map.set(nodeRefMap[it], it);
- }
+ template <typename NodeCrossRef>
+ UGraphCopy& nodeCrossRef(NodeCrossRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
+ NodeRefMap, NodeCrossRef>(map));
return *this;
}
- /// \brief Copies the edge references into the given map.
- ///
- /// Copies the edge references into the given map.
- template <typename EdgeRef>
- const UGraphCopy& edgeRef(EdgeRef& map) const {
- for (EdgeIt it(source); it != INVALID; ++it) {
- map.set(edgeRefMap[it], it);
- }
- return *this;
- }
-
- /// \brief Reverse and copies the undirected edge references into the
- /// given map.
- ///
- /// Reverse and copies the undirected edge references into the given map.
- template <typename EdgeRef>
- const UGraphCopy& edgeCrossRef(EdgeRef& map) const {
- for (EdgeIt it(source); it != INVALID; ++it) {
- map.set(it, edgeRefMap[it]);
- }
- return *this;
- }
-
- /// \brief Copies the undirected edge references into the given map.
+ /// \brief Make copy of the given map.
///
- /// Copies the undirected edge references into the given map.
- template <typename EdgeRef>
- const UGraphCopy& uEdgeRef(EdgeRef& map) const {
- for (UEdgeIt it(source); it != INVALID; ++it) {
- map.set(it, uEdgeRefMap[it]);
- }
+ /// 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
+ /// type.
+ template <typename TargetMap, typename SourceMap>
+ UGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node,
+ NodeRefMap, TargetMap, SourceMap>(tmap, map));
return *this;
}
- /// \brief Reverse and copies the undirected edge references into the
- /// given map.
+ /// \brief Copies the edge references into the given map.
///
- /// Reverse and copies the undirected edge references into the given map.
+ /// Copies the edge references into the given map.
template <typename EdgeRef>
- const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const {
- for (UEdgeIt it(source); it != INVALID; ++it) {
- map.set(uEdgeRefMap[it], it);
- }
+ UGraphCopy& edgeRef(EdgeRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge,
+ EdgeRefMap, EdgeRef>(map));
return *this;
}
- /// \brief Make copy of the given map.
+ /// \brief Reverse and copies the edge references into 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
- /// type.
- template <typename TargetMap, typename SourceMap>
- const UGraphCopy& nodeMap(TargetMap& tMap,
- const SourceMap& sMap) const {
- copyMap(tMap, sMap, NodeIt(source), nodeRefMap);
+ /// Reverse and copies the edge references into the given map.
+ template <typename EdgeCrossRef>
+ UGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
+ EdgeRefMap, EdgeCrossRef>(map));
return *this;
}
@@ -873,56 +944,84 @@
/// and the copied map's key type is the source graph's edge
/// type.
template <typename TargetMap, typename SourceMap>
- const UGraphCopy& edgeMap(TargetMap& tMap,
- const SourceMap& sMap) const {
- copyMap(tMap, sMap, EdgeIt(source), edgeRefMap);
+ UGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge,
+ EdgeRefMap, TargetMap, SourceMap>(tmap, map));
return *this;
}
- /// \brief Make copy of the given map.
+ /// \brief Copies the uEdge references into 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
- /// type.
- template <typename TargetMap, typename SourceMap>
- const UGraphCopy& uEdgeMap(TargetMap& tMap,
- const SourceMap& sMap) const {
- copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap);
+ /// Copies the uEdge references into the given map.
+ template <typename UEdgeRef>
+ UGraphCopy& uEdgeRef(UEdgeRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, UEdge,
+ UEdgeRefMap, UEdgeRef>(map));
return *this;
}
- /// \brief Gives back the stored node references.
+ /// \brief Reverse and copies the uEdge references into the given map.
///
- /// Gives back the stored node references.
- const NodeRefMap& nodeRef() const {
- return nodeRefMap;
+ /// Reverse and copies the uEdge references into the given map.
+ template <typename UEdgeCrossRef>
+ UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source,
+ UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
+ return *this;
}
- /// \brief Gives back the stored edge references.
+ /// \brief Make copy of the given map.
///
- /// Gives back the stored edge references.
- const EdgeRefMap& edgeRef() const {
- return edgeRefMap;
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the target graph's uEdge type,
+ /// and the copied map's key type is the source graph's uEdge
+ /// type.
+ template <typename TargetMap, typename SourceMap>
+ UGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, UEdge,
+ UEdgeRefMap, TargetMap, SourceMap>(tmap, map));
+ return *this;
}
- /// \brief Gives back the stored uedge references.
+ /// \brief Executes the copies.
///
- /// Gives back the stored uedge references.
- const UEdgeRefMap& uEdgeRef() const {
- return uEdgeRefMap;
+ /// Executes the copies.
+ void run() {
+ NodeRefMap nodeRefMap(source);
+ for (NodeIt it(source); it != INVALID; ++it) {
+ nodeRefMap[it] = target.addNode();
+ }
+ for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ nodeMapCopies[i]->copy(source, nodeRefMap);
+ }
+ UEdgeRefMap uEdgeRefMap(source);
+ EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
+ for (UEdgeIt it(source); it != INVALID; ++it) {
+ uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],
+ nodeRefMap[source.target(it)]);
+ }
+ for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
+ }
+ for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ edgeMapCopies[i]->copy(source, edgeRefMap);
+ }
}
- void run() const {}
-
private:
const Source& source;
Target& target;
- NodeRefMap nodeRefMap;
- EdgeRefMap edgeRefMap;
- UEdgeRefMap uEdgeRefMap;
+ std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* >
+ nodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* >
+ edgeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<Source, UEdge, UEdgeRefMap>* >
+ uEdgeMapCopies;
+
};
/// \brief Copy a graph to another graph.
@@ -931,7 +1030,7 @@
/// The usage of the function:
///
///\code
- /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr);
+ /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
///\endcode
///
/// After the copy the \c nr map will contain the mapping from the
@@ -971,7 +1070,7 @@
/// \brief Constructor.
///
/// Constructor for creating id map.
- IdMap(const Graph& _graph) : graph(&_graph) {}
+ explicit IdMap(const Graph& _graph) : graph(&_graph) {}
/// \brief Gives back the \e id of the item.
///
@@ -994,12 +1093,12 @@
/// \brief Constructor.
///
/// Constructor for creating an id-to-item map.
- InverseMap(const Graph& _graph) : graph(&_graph) {}
+ explicit InverseMap(const Graph& _graph) : graph(&_graph) {}
/// \brief Constructor.
///
/// Constructor for creating an id-to-item map.
- InverseMap(const IdMap& idMap) : graph(idMap.graph) {}
+ explicit InverseMap(const IdMap& idMap) : graph(idMap.graph) {}
/// \brief Gives back the given item from its id.
///
@@ -1066,7 +1165,7 @@
///
/// Construct a new InvertableMap for the graph.
///
- InvertableMap(const Graph& graph) : Map(graph) {}
+ explicit InvertableMap(const Graph& graph) : Map(graph) {}
/// \brief Forward iterator for values.
///
@@ -1192,7 +1291,8 @@
/// \brief Constructor of the InverseMap.
///
/// Constructor of the InverseMap.
- InverseMap(const InvertableMap& _inverted) : inverted(_inverted) {}
+ explicit InverseMap(const InvertableMap& _inverted)
+ : inverted(_inverted) {}
/// The value type of the InverseMap.
typedef typename InvertableMap::Key Value;
@@ -1264,7 +1364,7 @@
/// \brief Constructor.
///
/// Constructor for descriptor map.
- DescriptorMap(const Graph& _graph) : Map(_graph) {
+ explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
Item it;
const typename Map::Notifier* notifier = Map::getNotifier();
for (notifier->first(it); it != INVALID; notifier->next(it)) {
@@ -1273,6 +1373,7 @@
}
}
+
protected:
/// \brief Add a new key to the map.
@@ -1386,7 +1487,7 @@
/// \brief Constructor of the InverseMap.
///
/// Constructor of the InverseMap.
- InverseMap(const DescriptorMap& _inverted)
+ explicit InverseMap(const DescriptorMap& _inverted)
: inverted(_inverted) {}
@@ -1437,7 +1538,7 @@
///
/// Constructor
/// \param _graph The graph that the map belongs to.
- SourceMap(const Graph& _graph) : graph(_graph) {}
+ explicit SourceMap(const Graph& _graph) : graph(_graph) {}
/// \brief The subscript operator.
///
@@ -1476,7 +1577,7 @@
///
/// Constructor
/// \param _graph The graph that the map belongs to.
- TargetMap(const Graph& _graph) : graph(_graph) {}
+ explicit TargetMap(const Graph& _graph) : graph(_graph) {}
/// \brief The subscript operator.
///
@@ -1515,7 +1616,7 @@
///
/// Constructor
/// \param _graph The graph that the map belongs to.
- ForwardMap(const Graph& _graph) : graph(_graph) {}
+ explicit ForwardMap(const Graph& _graph) : graph(_graph) {}
/// \brief The subscript operator.
///
@@ -1554,7 +1655,7 @@
///
/// Constructor
/// \param _graph The graph that the map belongs to.
- BackwardMap(const Graph& _graph) : graph(_graph) {}
+ explicit BackwardMap(const Graph& _graph) : graph(_graph) {}
/// \brief The subscript operator.
///
@@ -1592,7 +1693,8 @@
/// \brief Constructor
///
/// Contructor of the map
- PotentialDifferenceMap(const Graph& _graph, const NodeMap& _potential)
+ explicit PotentialDifferenceMap(const Graph& _graph,
+ const NodeMap& _potential)
: graph(_graph), potential(_potential) {}
/// \brief Const subscription operator
@@ -1676,7 +1778,7 @@
/// \brief Constructor.
///
/// Constructor for creating in-degree map.
- InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+ explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
Parent::attach(graph.getNotifier(typename _Graph::Edge()));
for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
@@ -1788,7 +1890,7 @@
/// \brief Constructor.
///
/// Constructor for creating out-degree map.
- OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+ explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
Parent::attach(graph.getNotifier(typename _Graph::Edge()));
for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
More information about the Lemon-commits
mailing list