# HG changeset patch # User deba # Date 1096389655 0 # Node ID c0734a8c282c395018afc9aa05c47ed2d4a16c15 # Parent 751ed145bdae5d27edc576360245028ff96b6c79 Fix InEdgeIt and OutEdgeIt in the symmetric graphs. diff -r 751ed145bdae -r c0734a8c282c src/hugo/list_graph.h --- a/src/hugo/list_graph.h Tue Sep 28 13:45:39 2004 +0000 +++ b/src/hugo/list_graph.h Tue Sep 28 16:40:55 2004 +0000 @@ -102,6 +102,7 @@ first_free_node(_g.first_free_node), edges(_g.edges), first_free_edge(_g.first_free_edge) {} + /// \bug In the vector can be hole if a node is erased from the graph. ///Number of nodes. int nodeNum() const { return nodes.size(); } ///Number of edges. @@ -579,7 +580,7 @@ public: OutEdgeIt() {} OutEdgeIt(const SymListGraph& g, Edge e) { - if (e.id & 1 == 0) { + if ((e.id & 1) == 0) { out = Parent::OutEdgeIt(g, SymEdge(e)); in = Parent::InEdgeIt(g, g.tail(e)); } else { @@ -616,7 +617,7 @@ public: InEdgeIt() {} InEdgeIt(const SymListGraph& g, Edge e) { - if (e.id & 1 == 0) { + if ((e.id & 1) == 0) { out = Parent::OutEdgeIt(g, SymEdge(e)); in = Parent::InEdgeIt(g, g.tail(e)); } else { @@ -732,12 +733,12 @@ Node tail(Edge e) const { - return e.id & 1 == 0 ? + return (e.id & 1) == 0 ? Parent::tail(SymEdge(e)) : Parent::head(SymEdge(e)); } Node head(Edge e) const { - return e.id & 1 == 0 ? + return (e.id & 1) == 0 ? Parent::head(SymEdge(e)) : Parent::tail(SymEdge(e)); } @@ -822,14 +823,14 @@ return INVALID; } - /// Finds an symmetric edge between two nodes. +// /// Finds an symmetric edge between two nodes. - /// Finds an symmetric edge from node \c u to node \c v. - /// - /// 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 - /// the next edge from \c u to \c v after \c prev. - /// \return The found edge or INVALID if there is no such an edge. +// /// Finds an symmetric edge from node \c u to node \c v. +// /// +// /// 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 +// /// the next edge from \c u to \c v after \c prev. +// /// \return The found edge or INVALID if there is no such an edge. // SymEdge findEdge(Node u, Node v, SymEdge prev = INVALID) // { @@ -873,7 +874,7 @@ } static Edge backward(SymEdge e) { - return Edge((id(e) << 1) & 1); + return Edge((id(e) << 1) | 1); } }; diff -r 751ed145bdae -r c0734a8c282c src/hugo/smart_graph.h --- a/src/hugo/smart_graph.h Tue Sep 28 13:45:39 2004 +0000 +++ b/src/hugo/smart_graph.h Tue Sep 28 16:40:55 2004 +0000 @@ -394,7 +394,7 @@ public: OutEdgeIt() {} OutEdgeIt(const SymSmartGraph& g, Edge e) { - if (e.id & 1 == 0) { + if ((e.id & 1) == 0) { out = Parent::OutEdgeIt(g, SymEdge(e)); in = Parent::InEdgeIt(g, g.tail(e)); } else { @@ -431,7 +431,7 @@ public: InEdgeIt() {} InEdgeIt(const SymSmartGraph& g, Edge e) { - if (e.id & 1 == 0) { + if ((e.id & 1) == 0) { out = Parent::OutEdgeIt(g, SymEdge(e)); in = Parent::InEdgeIt(g, g.tail(e)); } else { @@ -540,12 +540,12 @@ Node tail(Edge e) const { - return e.id & 1 == 0 ? + return (e.id & 1) == 0 ? Parent::tail(SymEdge(e)) : Parent::head(SymEdge(e)); } Node head(Edge e) const { - return e.id & 1 == 0 ? + return (e.id & 1) == 0 ? Parent::head(SymEdge(e)) : Parent::tail(SymEdge(e)); } @@ -630,14 +630,14 @@ return INVALID; } - /// Finds an symmetric edge between two nodes. +// /// Finds an symmetric edge between two nodes. - /// Finds an symmetric edge from node \c u to node \c v. - /// - /// 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 - /// the next edge from \c u to \c v after \c prev. - /// \return The found edge or INVALID if there is no such an edge. +// /// Finds an symmetric edge from node \c u to node \c v. +// /// +// /// 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 +// /// the next edge from \c u to \c v after \c prev. +// /// \return The found edge or INVALID if there is no such an edge. // SymEdge findEdge(Node u, Node v, SymEdge prev = INVALID) // { @@ -667,7 +667,7 @@ } static Edge backward(SymEdge e) { - return Edge((id(e) << 1) & 1); + return Edge((id(e) << 1) | 1); } }; diff -r 751ed145bdae -r c0734a8c282c src/test/graph_test.h --- a/src/test/graph_test.h Tue Sep 28 13:45:39 2004 +0000 +++ b/src/test/graph_test.h Tue Sep 28 16:40:55 2004 +0000 @@ -298,6 +298,7 @@ typename Graph::OutEdgeIt e(G,n); for(int i=0;i