1.1 --- a/lemon/list_graph.h Tue Jul 29 13:58:03 2008 +0200
1.2 +++ b/lemon/list_graph.h Tue Jul 29 14:54:08 2008 +0200
1.3 @@ -395,9 +395,9 @@
1.4 /// added to the graph.
1.5 bool valid(Arc a) const { return Parent::valid(a); }
1.6
1.7 - /// Change the target of \c e to \c n
1.8 + /// Change the target of \c a to \c n
1.9
1.10 - /// Change the target of \c e to \c n
1.11 + /// Change the target of \c a to \c n
1.12 ///
1.13 ///\note The <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s referencing
1.14 ///the changed arc remain valid. However <tt>InArcIt</tt>s are
1.15 @@ -405,21 +405,21 @@
1.16 ///
1.17 ///\warning This functionality cannot be used together with the Snapshot
1.18 ///feature.
1.19 - void changeTarget(Arc e, Node n) {
1.20 - Parent::changeTarget(e,n);
1.21 + void changeTarget(Arc a, Node n) {
1.22 + Parent::changeTarget(a,n);
1.23 }
1.24 - /// Change the source of \c e to \c n
1.25 + /// Change the source of \c a to \c n
1.26
1.27 - /// Change the source of \c e to \c n
1.28 + /// Change the source of \c a to \c n
1.29 ///
1.30 - ///\note The <tt>ArcIt</tt>s and <tt>InArcIt</tt>s referencing
1.31 - ///the changed arc remain valid. However <tt>OutArcIt</tt>s are
1.32 + ///\note The <tt>InArcIt</tt>s referencing the changed arc remain
1.33 + ///valid. However the <tt>ArcIt<tt>s and <tt>OutArcIt</tt>s are
1.34 ///invalidated.
1.35 ///
1.36 ///\warning This functionality cannot be used together with the Snapshot
1.37 ///feature.
1.38 - void changeSource(Arc e, Node n) {
1.39 - Parent::changeSource(e,n);
1.40 + void changeSource(Arc a, Node n) {
1.41 + Parent::changeSource(a,n);
1.42 }
1.43
1.44 /// Invert the direction of an arc.
1.45 @@ -1116,7 +1116,7 @@
1.46
1.47 protected:
1.48
1.49 - void changeTarget(Edge e, Node n) {
1.50 + void changeV(Edge e, Node n) {
1.51 if(arcs[2 * e.id].next_out != -1) {
1.52 arcs[arcs[2 * e.id].next_out].prev_out = arcs[2 * e.id].prev_out;
1.53 }
1.54 @@ -1137,7 +1137,7 @@
1.55 nodes[n.id].first_out = 2 * e.id;
1.56 }
1.57
1.58 - void changeSource(Edge e, Node n) {
1.59 + void changeU(Edge e, Node n) {
1.60 if(arcs[(2 * e.id) | 1].next_out != -1) {
1.61 arcs[arcs[(2 * e.id) | 1].next_out].prev_out =
1.62 arcs[(2 * e.id) | 1].prev_out;
1.63 @@ -1260,66 +1260,32 @@
1.64 /// could become valid again later if new edges are
1.65 /// added to the graph.
1.66 bool valid(Edge e) const { return Parent::valid(e); }
1.67 - /// \brief Change the source of \c e to \c n
1.68 + /// \brief Change the end \c u of \c e to \c n
1.69 ///
1.70 - /// This function changes the source of \c e to \c n.
1.71 + /// This function changes the end \c u of \c e to node \c n.
1.72 ///
1.73 - ///\note The <tt>ArcIt</tt>s and <tt>InArcIt</tt>s
1.74 - ///referencing the changed arc remain
1.75 - ///valid. However <tt>OutArcIt</tt>s are invalidated.
1.76 + ///\note The <tt>EdgeIt</tt>s and <tt>ArcIt</tt>s referencing the
1.77 + ///changed edge are invalidated and if the changed node is the
1.78 + ///base node of an iterator then this iterator is also
1.79 + ///invalidated.
1.80 ///
1.81 ///\warning This functionality cannot be used together with the
1.82 ///Snapshot feature.
1.83 - void changeSource(Edge e, Node n) {
1.84 - Parent::changeSource(e,n);
1.85 + void changeU(Edge e, Node n) {
1.86 + Parent::changeU(e,n);
1.87 }
1.88 - /// \brief Change the target of \c e to \c n
1.89 + /// \brief Change the end \c v of \c e to \c n
1.90 ///
1.91 - /// This function changes the target of \c e to \c n.
1.92 + /// This function changes the end \c v of \c e to \c n.
1.93 ///
1.94 - /// \note The <tt>ArcIt</tt>s referencing the changed arc remain
1.95 - /// valid. However the other iterators may be invalidated.
1.96 + ///\note The <tt>EdgeIt</tt>s referencing the changed edge remain
1.97 + ///valid, however <tt>ArcIt</tt>s and if the changed node is the
1.98 + ///base node of an iterator then this iterator is invalidated.
1.99 ///
1.100 ///\warning This functionality cannot be used together with the
1.101 ///Snapshot feature.
1.102 - void changeTarget(Edge e, Node n) {
1.103 - Parent::changeTarget(e,n);
1.104 - }
1.105 - /// \brief Change the source of \c e to \c n
1.106 - ///
1.107 - /// This function changes the source of \c e to \c n.
1.108 - /// It also changes the proper node of the represented edge.
1.109 - ///
1.110 - ///\note The <tt>ArcIt</tt>s and <tt>InArcIt</tt>s
1.111 - ///referencing the changed arc remain
1.112 - ///valid. However <tt>OutArcIt</tt>s are invalidated.
1.113 - ///
1.114 - ///\warning This functionality cannot be used together with the
1.115 - ///Snapshot feature.
1.116 - void changeSource(Arc e, Node n) {
1.117 - if (Parent::direction(e)) {
1.118 - Parent::changeSource(e,n);
1.119 - } else {
1.120 - Parent::changeTarget(e,n);
1.121 - }
1.122 - }
1.123 - /// \brief Change the target of \c e to \c n
1.124 - ///
1.125 - /// This function changes the target of \c e to \c n.
1.126 - /// It also changes the proper node of the represented edge.
1.127 - ///
1.128 - ///\note The <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s
1.129 - ///referencing the changed arc remain
1.130 - ///valid. However <tt>InArcIt</tt>s are invalidated.
1.131 - ///
1.132 - ///\warning This functionality cannot be used together with the
1.133 - ///Snapshot feature.
1.134 - void changeTarget(Arc e, Node n) {
1.135 - if (Parent::direction(e)) {
1.136 - Parent::changeTarget(e,n);
1.137 - } else {
1.138 - Parent::changeSource(e,n);
1.139 - }
1.140 + void changeV(Edge e, Node n) {
1.141 + Parent::changeV(e,n);
1.142 }
1.143 /// \brief Contract two nodes.
1.144 ///
1.145 @@ -1339,10 +1305,10 @@
1.146 IncEdgeIt f = e; ++f;
1.147 if (r && runningNode(e) == a) {
1.148 erase(e);
1.149 - } else if (source(e) == b) {
1.150 - changeSource(e, a);
1.151 + } else if (u(e) == b) {
1.152 + changeU(e, a);
1.153 } else {
1.154 - changeTarget(e, a);
1.155 + changeV(e, a);
1.156 }
1.157 e = f;
1.158 }