diff -r e225719bde6b -r 2d806130e700 lemon/graph_utils.h --- a/lemon/graph_utils.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_utils.h Thu Jan 26 15:42:13 2006 +0000 @@ -71,8 +71,8 @@ ///This \c \#define creates the same convenience typedefs as defined by ///\ref GRAPH_TYPEDEFS(Graph) and three more, namely it creates - ///\c UndirEdge, \c UndirEdgeIt, \c IncEdgeIt, - ///\c BoolUndirEdgeMap, \c IntUndirEdgeMap, \c DoubleUndirEdgeMap. + ///\c UEdge, \c UEdgeIt, \c IncEdgeIt, + ///\c BoolUEdgeMap, \c IntUEdgeMap, \c DoubleUEdgeMap. /// ///\note If \c G it a template parameter, it should be used in this way. ///\code @@ -83,12 +83,12 @@ ///template typedefs in C++. #define UNDIRGRAPH_TYPEDEFS(Graph) \ GRAPH_TYPEDEFS(Graph) \ - typedef Graph:: UndirEdge UndirEdge; \ - typedef Graph:: UndirEdgeIt UndirEdgeIt; \ + typedef Graph:: UEdge UEdge; \ + typedef Graph:: UEdgeIt UEdgeIt; \ typedef Graph:: IncEdgeIt IncEdgeIt; -// typedef Graph::template UndirEdgeMap BoolUndirEdgeMap; -// typedef Graph::template UndirEdgeMap IntUndirEdgeMap; -// typedef Graph::template UndirEdgeMap DoubleUndirEdgeMap; +// typedef Graph::template UEdgeMap BoolUEdgeMap; +// typedef Graph::template UEdgeMap IntUEdgeMap; +// typedef Graph::template UEdgeMap DoubleUEdgeMap; @@ -162,13 +162,13 @@ template inline typename enable_if::type - _countUndirEdges(const Graph &g) { - return g.undirEdgeNum(); + _countUEdges(const Graph &g) { + return g.uEdgeNum(); } template - inline int _countUndirEdges(Wrap w) { - return countItems(w.value); + inline int _countUEdges(Wrap w) { + return countItems(w.value); } /// \brief Function to count the undirected edges in the graph. @@ -178,8 +178,8 @@ /// graph structures it is specialized to run in O(1). template - inline int countUndirEdges(const Graph& g) { - return _countUndirEdges(g); + inline int countUEdges(const Graph& g) { + return _countUEdges(g); } @@ -325,19 +325,19 @@ inline typename enable_if< typename Graph::FindEdgeTag, - typename Graph::UndirEdge>::type - _findUndirEdge(const Graph &g, + typename Graph::UEdge>::type + _findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { - return g.findUndirEdge(u, v, prev); + typename Graph::UEdge prev = INVALID) { + return g.findUEdge(u, v, prev); } template - inline typename Graph::UndirEdge - _findUndirEdge(Wrap w, + inline typename Graph::UEdge + _findUEdge(Wrap w, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { + typename Graph::UEdge prev = INVALID) { const Graph& g = w.value; if (prev == INVALID) { typename Graph::OutEdgeIt e(g, u); @@ -350,9 +350,9 @@ } } - /// \brief Finds an undir edge between two nodes of a graph. + /// \brief Finds an uedge between two nodes of a graph. /// - /// Finds an undir edge from node \c u to node \c v in graph \c g. + /// Finds an uedge from node \c u to node \c v in graph \c g. /// /// If \c prev is \ref INVALID (this is the default value), then /// it finds the first edge from \c u to \c v. Otherwise it looks for @@ -361,63 +361,63 @@ /// /// Thus you can iterate through each edge from \c u to \c v as it follows. /// \code - /// for(UndirEdge e = findUndirEdge(g,u,v); e != INVALID; - /// e = findUndirEdge(g,u,v,e)) { + /// for(UEdge e = findUEdge(g,u,v); e != INVALID; + /// e = findUEdge(g,u,v,e)) { /// ... /// } /// \endcode // /// \todo We may want to use the "GraphBase" // /// interface here... template - inline typename Graph::UndirEdge - findUndirEdge(const Graph &g, + inline typename Graph::UEdge + findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { - return _findUndirEdge(g, u, v, prev); + typename Graph::UEdge prev = INVALID) { + return _findUEdge(g, u, v, prev); } - /// \brief Iterator for iterating on undir edges connected the same nodes. + /// \brief Iterator for iterating on uedges connected the same nodes. /// - /// Iterator for iterating on undir edges connected the same nodes. It is - /// higher level interface for the findUndirEdge() function. You can + /// Iterator for iterating on uedges connected the same nodes. It is + /// higher level interface for the findUEdge() function. You can /// use it the following way: /// \code - /// for (ConUndirEdgeIt it(g, src, trg); it != INVALID; ++it) { + /// for (ConUEdgeIt it(g, src, trg); it != INVALID; ++it) { /// ... /// } /// \endcode /// /// \author Balazs Dezso template - class ConUndirEdgeIt : public _Graph::UndirEdge { + class ConUEdgeIt : public _Graph::UEdge { public: typedef _Graph Graph; - typedef typename Graph::UndirEdge Parent; + typedef typename Graph::UEdge Parent; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; typedef typename Graph::Node Node; /// \brief Constructor. /// - /// Construct a new ConUndirEdgeIt iterating on the edges which + /// Construct a new ConUEdgeIt iterating on the edges which /// connects the \c u and \c v node. - ConUndirEdgeIt(const Graph& g, Node u, Node v) : graph(g) { - Parent::operator=(findUndirEdge(graph, u, v)); + ConUEdgeIt(const Graph& g, Node u, Node v) : graph(g) { + Parent::operator=(findUEdge(graph, u, v)); } /// \brief Constructor. /// - /// Construct a new ConUndirEdgeIt which continues the iterating from + /// Construct a new ConUEdgeIt which continues the iterating from /// the \c e edge. - ConUndirEdgeIt(const Graph& g, UndirEdge e) : Parent(e), graph(g) {} + ConUEdgeIt(const Graph& g, UEdge e) : Parent(e), graph(g) {} /// \brief Increment operator. /// /// It increments the iterator and gives back the next edge. - ConUndirEdgeIt& operator++() { - Parent::operator=(findUndirEdge(graph, graph.source(*this), + ConUEdgeIt& operator++() { + Parent::operator=(findUEdge(graph, graph.source(*this), graph.target(*this), *this)); return *this; } @@ -596,53 +596,53 @@ /// \brief Class to copy an undirected graph. /// /// Class to copy an undirected graph to an other graph (duplicate a graph). - /// The simplest way of using it is through the \c copyUndirGraph() function. + /// The simplest way of using it is through the \c copyUGraph() function. template - class UndirGraphCopy { + class UGraphCopy { public: typedef typename Source::Node Node; typedef typename Source::NodeIt NodeIt; typedef typename Source::Edge Edge; typedef typename Source::EdgeIt EdgeIt; - typedef typename Source::UndirEdge UndirEdge; - typedef typename Source::UndirEdgeIt UndirEdgeIt; + typedef typename Source::UEdge UEdge; + typedef typename Source::UEdgeIt UEdgeIt; typedef typename Source:: template NodeMap NodeRefMap; typedef typename Source:: - template UndirEdgeMap UndirEdgeRefMap; + template UEdgeMap UEdgeRefMap; private: struct EdgeRefMap { - EdgeRefMap(UndirGraphCopy& _gc) : gc(_gc) {} + EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {} typedef typename Source::Edge Key; typedef typename Target::Edge Value; Value operator[](const Key& key) { - return gc.target.direct(gc.undirEdgeRef[key], + return gc.target.direct(gc.uEdgeRef[key], gc.target.direction(key)); } - UndirGraphCopy& gc; + UGraphCopy& gc; }; public: - /// \brief Constructor for the UndirGraphCopy. + /// \brief Constructor for the UGraphCopy. /// /// 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. - UndirGraphCopy(Target& _target, const Source& _source) + UGraphCopy(Target& _target, const Source& _source) : source(_source), target(_target), - nodeRefMap(_source), edgeRefMap(*this), undirEdgeRefMap(_source) { + nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) { for (NodeIt it(source); it != INVALID; ++it) { nodeRefMap[it] = target.addNode(); } - for (UndirEdgeIt it(source); it != INVALID; ++it) { - undirEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], + for (UEdgeIt it(source); it != INVALID; ++it) { + uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], nodeRefMap[source.target(it)]); } } @@ -651,7 +651,7 @@ /// /// Copies the node references into the given map. template - const UndirGraphCopy& nodeRef(NodeRef& map) const { + const UGraphCopy& nodeRef(NodeRef& map) const { for (NodeIt it(source); it != INVALID; ++it) { map.set(it, nodeRefMap[it]); } @@ -662,7 +662,7 @@ /// /// Reverse and copies the node references into the given map. template - const UndirGraphCopy& nodeCrossRef(NodeRef& map) const { + const UGraphCopy& nodeCrossRef(NodeRef& map) const { for (NodeIt it(source); it != INVALID; ++it) { map.set(nodeRefMap[it], it); } @@ -673,7 +673,7 @@ /// /// Copies the edge references into the given map. template - const UndirGraphCopy& edgeRef(EdgeRef& map) const { + const UGraphCopy& edgeRef(EdgeRef& map) const { for (EdgeIt it(source); it != INVALID; ++it) { map.set(edgeRefMap[it], it); } @@ -685,7 +685,7 @@ /// /// Reverse and copies the undirected edge references into the given map. template - const UndirGraphCopy& edgeCrossRef(EdgeRef& map) const { + const UGraphCopy& edgeCrossRef(EdgeRef& map) const { for (EdgeIt it(source); it != INVALID; ++it) { map.set(it, edgeRefMap[it]); } @@ -696,9 +696,9 @@ /// /// Copies the undirected edge references into the given map. template - const UndirGraphCopy& undirEdgeRef(EdgeRef& map) const { - for (UndirEdgeIt it(source); it != INVALID; ++it) { - map.set(it, undirEdgeRefMap[it]); + const UGraphCopy& uEdgeRef(EdgeRef& map) const { + for (UEdgeIt it(source); it != INVALID; ++it) { + map.set(it, uEdgeRefMap[it]); } return *this; } @@ -708,9 +708,9 @@ /// /// Reverse and copies the undirected edge references into the given map. template - const UndirGraphCopy& undirEdgeCrossRef(EdgeRef& map) const { - for (UndirEdgeIt it(source); it != INVALID; ++it) { - map.set(undirEdgeRefMap[it], it); + const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const { + for (UEdgeIt it(source); it != INVALID; ++it) { + map.set(uEdgeRefMap[it], it); } return *this; } @@ -722,7 +722,7 @@ /// and the copied map's key type is the source graph's node /// type. template - const UndirGraphCopy& nodeMap(TargetMap& tMap, + const UGraphCopy& nodeMap(TargetMap& tMap, const SourceMap& sMap) const { copyMap(tMap, sMap, NodeIt(source), nodeRefMap); return *this; @@ -735,7 +735,7 @@ /// and the copied map's key type is the source graph's edge /// type. template - const UndirGraphCopy& edgeMap(TargetMap& tMap, + const UGraphCopy& edgeMap(TargetMap& tMap, const SourceMap& sMap) const { copyMap(tMap, sMap, EdgeIt(source), edgeRefMap); return *this; @@ -748,9 +748,9 @@ /// and the copied map's key type is the source graph's edge /// type. template - const UndirGraphCopy& undirEdgeMap(TargetMap& tMap, + const UGraphCopy& uEdgeMap(TargetMap& tMap, const SourceMap& sMap) const { - copyMap(tMap, sMap, UndirEdgeIt(source), undirEdgeRefMap); + copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap); return *this; } @@ -768,11 +768,11 @@ return edgeRefMap; } - /// \brief Gives back the stored undir edge references. + /// \brief Gives back the stored uedge references. /// - /// Gives back the stored undir edge references. - const UndirEdgeRefMap& undirEdgeRef() const { - return undirEdgeRefMap; + /// Gives back the stored uedge references. + const UEdgeRefMap& uEdgeRef() const { + return uEdgeRefMap; } void run() {} @@ -784,7 +784,7 @@ NodeRefMap nodeRefMap; EdgeRefMap edgeRefMap; - UndirEdgeRefMap undirEdgeRefMap; + UEdgeRefMap uEdgeRefMap; }; /// \brief Copy a graph to an other graph. @@ -801,9 +801,9 @@ /// contain the mapping from the target graph's edges to the source's /// edges. template - UndirGraphCopy - copyUndirGraph(Target& target, const Source& source) { - return UndirGraphCopy(target, source); + UGraphCopy + copyUGraph(Target& target, const Source& source) { + return UGraphCopy(target, source); } @@ -905,7 +905,7 @@ typedef _Map Map; typedef _Graph Graph; - /// The key type of InvertableMap (Node, Edge, UndirEdge). + /// The key type of InvertableMap (Node, Edge, UEdge). typedef typename _Map::Key Key; /// The value type of the InvertableMap. typedef typename _Map::Value Value; @@ -1036,7 +1036,7 @@ /// /// \param _Graph The graph class the \c DescriptorMap belongs to. /// \param _Item The Item is the Key of the Map. It may be Node, Edge or - /// UndirEdge. + /// UEdge. #ifndef DOXYGEN /// \param _Map A ReadWriteMap mapping from the item type to integer. template < @@ -1055,7 +1055,7 @@ /// The graph class of DescriptorMap. typedef _Graph Graph; - /// The key type of DescriptorMap (Node, Edge, UndirEdge). + /// The key type of DescriptorMap (Node, Edge, UEdge). typedef typename _Map::Key Key; /// The value type of DescriptorMap. typedef typename _Map::Value Value; @@ -1296,7 +1296,7 @@ public: typedef typename Graph::Edge Value; - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; /// \brief Constructor /// @@ -1335,7 +1335,7 @@ public: typedef typename Graph::Edge Value; - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; /// \brief Constructor ///