Changeset 1627:3fd1ba6e9872 in lemon-0.x for lemon/bits
- Timestamp:
- 08/11/05 17:55:17 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2135
- Location:
- lemon/bits
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/erasable_graph_extender.h
r1435 r1627 71 71 void erase(const UndirEdge& uedge) { 72 72 std::vector<Edge> edges; 73 edges.push_back( Edge(uedge,true));74 edges.push_back( Edge(uedge,false));73 edges.push_back(Parent::direct(uedge,true)); 74 edges.push_back(Parent::direct(uedge,false)); 75 75 Parent::getNotifier(Edge()).erase(edges); 76 76 Parent::getNotifier(UndirEdge()).erase(uedge); -
lemon/bits/extendable_graph_extender.h
r1435 r1627 52 52 53 53 std::vector<Edge> edges; 54 edges.push_back( Edge(uedge, true));55 edges.push_back( Edge(uedge, false));54 edges.push_back(Parent::direct(uedge, true)); 55 edges.push_back(Parent::direct(uedge, false)); 56 56 Parent::getNotifier(Edge()).add(edges); 57 57 -
lemon/bits/iterable_graph_extender.h
r1564 r1627 119 119 }; 120 120 121 /// Base node of the iterator121 /// \brief Base node of the iterator 122 122 /// 123 123 /// Returns the base node (ie. the source in this case) of the iterator 124 ///125 /// \todo Document in the concept!126 124 Node baseNode(const OutEdgeIt &e) const { 127 125 return Parent::source((Edge)e); 128 126 } 129 /// Running node of the iterator127 /// \brief Running node of the iterator 130 128 /// 131 129 /// Returns the running node (ie. the target in this case) of the 132 130 /// iterator 133 ///134 /// \todo Document in the concept!135 131 Node runningNode(const OutEdgeIt &e) const { 136 132 return Parent::target((Edge)e); 137 133 } 138 134 139 /// Base node of the iterator135 /// \brief Base node of the iterator 140 136 /// 141 137 /// Returns the base node (ie. the target in this case) of the iterator 142 ///143 /// \todo Document in the concept!144 138 Node baseNode(const InEdgeIt &e) const { 145 139 return Parent::target((Edge)e); 146 140 } 147 /// Running node of the iterator141 /// \brief Running node of the iterator 148 142 /// 149 143 /// Returns the running node (ie. the source in this case) of the 150 144 /// iterator 151 ///152 /// \todo Document in the concept!153 145 Node runningNode(const InEdgeIt &e) const { 154 146 return Parent::source((Edge)e); … … 157 149 using Parent::first; 158 150 151 /// \brief The opposite node on the given edge. 152 /// 153 /// Gives back the opposite on the given edge. 154 Node oppositeNode(const Node& n, const Edge& e) const { 155 if (Parent::source(e) == n) { 156 return Parent::target(e); 157 } else { 158 return Parent::source(e); 159 } 160 } 161 159 162 private: 160 161 // /// \todo When (and if) we change the iterators concept to use operator*,162 // /// then the following shadowed methods will become superfluous.163 // /// But for now these are important safety measures.164 163 165 164 // void first(NodeIt &) const; … … 191 190 typedef IterableUndirGraphExtender<_Base> Graph; 192 191 typedef typename Parent::Node Node; 193 192 typedef typename Parent::Edge Edge; 194 193 typedef typename Parent::UndirEdge UndirEdge; 195 194 … … 262 261 } 263 262 263 /// \brief The opposite node on the given undirected edge. 264 /// 265 /// Gives back the opposite on the given undirected edge. 266 Node oppositeNode(const Node& n, const UndirEdge& e) const { 267 if (Parent::source(e) == n) { 268 return Parent::target(e); 269 } else { 270 return Parent::source(e); 271 } 272 } 273 264 274 }; 265 275 } -
lemon/bits/undir_graph_extender.h
r1435 r1627 43 43 bool forward; 44 44 45 Edge(const UndirEdge &ue, bool _forward) : 46 UndirEdge(ue), forward(_forward) {} 47 45 48 public: 46 49 Edge() {} 47 48 /// \brief Directed edge from undirected edge and a direction.49 ///50 /// This constructor is not a part of the concept interface of51 /// undirected graph, so please avoid using it if possible!52 Edge(const UndirEdge &ue, bool _forward) :53 UndirEdge(ue), forward(_forward) {}54 55 /// \brief Directed edge from undirected edge and a source node.56 ///57 /// Constructs a directed edge from undirected edge and a source node.58 ///59 /// \note You have to specify the graph for this constructor.60 Edge(const Graph &g, const UndirEdge &ue, const Node &n) :61 UndirEdge(ue) { forward = (g.source(ue) == n); }62 50 63 51 /// Invalid edge constructor … … 80 68 /// 81 69 /// Returns the Edge of opposite direction. 82 Edge opposite (const Edge &e) const {70 Edge oppositeEdge(const Edge &e) const { 83 71 return Edge(e,!e.forward); 84 72 } … … 114 102 return _dirTarget(e); 115 103 } 116 117 /// Returns whether the given directed edge is same orientation as the118 /// corresponding undirected edge.119 ///120 /// \todo reference to the corresponding point of the undirected graph121 /// concept. "What does the direction of an undirected edge mean?"122 bool forward(const Edge &e) const { return e.forward; }123 104 124 105 Node oppositeNode(const Node &n, const UndirEdge &e) const { … … 131 112 } 132 113 133 /// Directed edge from an undirected edge and a source node.114 /// \brief Directed edge from an undirected edge and a source node. 134 115 /// 135 116 /// Returns a (directed) Edge corresponding to the specified UndirEdge 136 117 /// and source Node. 137 118 /// 138 ///\todo Do we need this? 139 /// 140 ///\todo Better name... 141 Edge edgeWithSource(const UndirEdge &ue, const Node &s) const { 142 return Edge(*this, ue, s); 143 } 119 Edge direct(const UndirEdge &ue, const Node &s) const { 120 return Edge(ue, s == source(ue)); 121 } 122 123 /// \brief Directed edge from an undirected edge. 124 /// 125 /// Returns a directed edge corresponding to the specified UndirEdge. 126 /// If the given bool is true the given undirected edge and the 127 /// returned edge have the same source node. 128 Edge direct(const UndirEdge &ue, bool d) const { 129 return Edge(ue, d); 130 } 131 132 /// Returns whether the given directed edge is same orientation as the 133 /// corresponding undirected edge. 134 /// 135 /// \todo reference to the corresponding point of the undirected graph 136 /// concept. "What does the direction of an undirected edge mean?" 137 bool direction(const Edge &e) const { return e.forward; } 138 144 139 145 140 using Parent::first;
Note: See TracChangeset
for help on using the changeset viewer.