1.1 --- a/lemon/list_graph.h Thu Mar 01 16:04:12 2007 +0000
1.2 +++ b/lemon/list_graph.h Thu Mar 01 16:47:23 2007 +0000
1.3 @@ -527,10 +527,11 @@
1.4 }
1.5 }
1.6 virtual void build() {
1.7 - NodeNotifier* notifier = getNotifier();
1.8 + NodeNotifier* _notifier = notifier();
1.9 Node node;
1.10 std::vector<Node> nodes;
1.11 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.12 + for (_notifier->first(node); node != INVALID;
1.13 + _notifier->next(node)) {
1.14 nodes.push_back(node);
1.15 }
1.16 for (int i = nodes.size() - 1; i >= 0; --i) {
1.17 @@ -538,9 +539,10 @@
1.18 }
1.19 }
1.20 virtual void clear() {
1.21 - NodeNotifier* notifier = getNotifier();
1.22 + NodeNotifier* _notifier = notifier();
1.23 Node node;
1.24 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.25 + for (_notifier->first(node); node != INVALID;
1.26 + _notifier->next(node)) {
1.27 snapshot.eraseNode(node);
1.28 }
1.29 }
1.30 @@ -577,10 +579,11 @@
1.31 }
1.32 }
1.33 virtual void build() {
1.34 - EdgeNotifier* notifier = getNotifier();
1.35 + EdgeNotifier* _notifier = notifier();
1.36 Edge edge;
1.37 std::vector<Edge> edges;
1.38 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.39 + for (_notifier->first(edge); edge != INVALID;
1.40 + _notifier->next(edge)) {
1.41 edges.push_back(edge);
1.42 }
1.43 for (int i = edges.size() - 1; i >= 0; --i) {
1.44 @@ -588,9 +591,9 @@
1.45 }
1.46 }
1.47 virtual void clear() {
1.48 - EdgeNotifier* notifier = getNotifier();
1.49 + EdgeNotifier* _notifier = notifier();
1.50 Edge edge;
1.51 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.52 + for (_notifier->first(edge); edge != INVALID; _notifier->next(edge)) {
1.53 snapshot.eraseEdge(edge);
1.54 }
1.55 }
1.56 @@ -639,8 +642,8 @@
1.57
1.58 void attach(ListGraph &_graph) {
1.59 graph = &_graph;
1.60 - node_observer_proxy.attach(graph->getNotifier(Node()));
1.61 - edge_observer_proxy.attach(graph->getNotifier(Edge()));
1.62 + node_observer_proxy.attach(graph->notifier(Node()));
1.63 + edge_observer_proxy.attach(graph->notifier(Edge()));
1.64 }
1.65
1.66 void detach() {
1.67 @@ -911,13 +914,23 @@
1.68
1.69 void firstInc(UEdge &e, bool& d, const Node& v) const {
1.70 int de = nodes[v.id].first_out;
1.71 - e.id = de / 2;
1.72 - d = ((de & 1) == 1);
1.73 + if (de != -1 ) {
1.74 + e.id = de / 2;
1.75 + d = ((de & 1) == 1);
1.76 + } else {
1.77 + e.id = -1;
1.78 + d = true;
1.79 + }
1.80 }
1.81 void nextInc(UEdge &e, bool& d) const {
1.82 int de = (edges[(e.id * 2) | (d ? 1 : 0)].next_out);
1.83 - e.id = de / 2;
1.84 - d = ((de & 1) == 1);
1.85 + if (de != -1 ) {
1.86 + e.id = de / 2;
1.87 + d = ((de & 1) == 1);
1.88 + } else {
1.89 + e.id = -1;
1.90 + d = true;
1.91 + }
1.92 }
1.93
1.94 static int id(Node v) { return v.id; }
1.95 @@ -1261,10 +1274,11 @@
1.96 }
1.97 }
1.98 virtual void build() {
1.99 - NodeNotifier* notifier = getNotifier();
1.100 + NodeNotifier* _notifier = notifier();
1.101 Node node;
1.102 std::vector<Node> nodes;
1.103 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.104 + for (_notifier->first(node); node != INVALID;
1.105 + _notifier->next(node)) {
1.106 nodes.push_back(node);
1.107 }
1.108 for (int i = nodes.size() - 1; i >= 0; --i) {
1.109 @@ -1272,9 +1286,10 @@
1.110 }
1.111 }
1.112 virtual void clear() {
1.113 - NodeNotifier* notifier = getNotifier();
1.114 + NodeNotifier* _notifier = notifier();
1.115 Node node;
1.116 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.117 + for (_notifier->first(node); node != INVALID;
1.118 + _notifier->next(node)) {
1.119 snapshot.eraseNode(node);
1.120 }
1.121 }
1.122 @@ -1311,10 +1326,11 @@
1.123 }
1.124 }
1.125 virtual void build() {
1.126 - UEdgeNotifier* notifier = getNotifier();
1.127 + UEdgeNotifier* _notifier = notifier();
1.128 UEdge edge;
1.129 std::vector<UEdge> edges;
1.130 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.131 + for (_notifier->first(edge); edge != INVALID;
1.132 + _notifier->next(edge)) {
1.133 edges.push_back(edge);
1.134 }
1.135 for (int i = edges.size() - 1; i >= 0; --i) {
1.136 @@ -1322,9 +1338,10 @@
1.137 }
1.138 }
1.139 virtual void clear() {
1.140 - UEdgeNotifier* notifier = getNotifier();
1.141 + UEdgeNotifier* _notifier = notifier();
1.142 UEdge edge;
1.143 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.144 + for (_notifier->first(edge); edge != INVALID;
1.145 + _notifier->next(edge)) {
1.146 snapshot.eraseUEdge(edge);
1.147 }
1.148 }
1.149 @@ -1373,8 +1390,8 @@
1.150
1.151 void attach(ListUGraph &_graph) {
1.152 graph = &_graph;
1.153 - node_observer_proxy.attach(graph->getNotifier(Node()));
1.154 - edge_observer_proxy.attach(graph->getNotifier(UEdge()));
1.155 + node_observer_proxy.attach(graph->notifier(Node()));
1.156 + edge_observer_proxy.attach(graph->notifier(UEdge()));
1.157 }
1.158
1.159 void detach() {
1.160 @@ -2039,10 +2056,11 @@
1.161 }
1.162 }
1.163 virtual void build() {
1.164 - NodeNotifier* notifier = getNotifier();
1.165 + NodeNotifier* _notifier = notifier();
1.166 Node node;
1.167 std::vector<Node> nodes;
1.168 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.169 + for (_notifier->first(node); node != INVALID;
1.170 + _notifier->next(node)) {
1.171 nodes.push_back(node);
1.172 }
1.173 for (int i = nodes.size() - 1; i >= 0; --i) {
1.174 @@ -2050,9 +2068,10 @@
1.175 }
1.176 }
1.177 virtual void clear() {
1.178 - NodeNotifier* notifier = getNotifier();
1.179 + NodeNotifier* _notifier = notifier();
1.180 Node node;
1.181 - for (notifier->first(node); node != INVALID; notifier->next(node)) {
1.182 + for (_notifier->first(node); node != INVALID;
1.183 + _notifier->next(node)) {
1.184 snapshot.eraseNode(node);
1.185 }
1.186 }
1.187 @@ -2089,10 +2108,11 @@
1.188 }
1.189 }
1.190 virtual void build() {
1.191 - UEdgeNotifier* notifier = getNotifier();
1.192 + UEdgeNotifier* _notifier = notifier();
1.193 UEdge edge;
1.194 std::vector<UEdge> edges;
1.195 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.196 + for (_notifier->first(edge); edge != INVALID;
1.197 + _notifier->next(edge)) {
1.198 edges.push_back(edge);
1.199 }
1.200 for (int i = edges.size() - 1; i >= 0; --i) {
1.201 @@ -2100,9 +2120,10 @@
1.202 }
1.203 }
1.204 virtual void clear() {
1.205 - UEdgeNotifier* notifier = getNotifier();
1.206 + UEdgeNotifier* _notifier = notifier();
1.207 UEdge edge;
1.208 - for (notifier->first(edge); edge != INVALID; notifier->next(edge)) {
1.209 + for (_notifier->first(edge); edge != INVALID;
1.210 + _notifier->next(edge)) {
1.211 snapshot.eraseUEdge(edge);
1.212 }
1.213 }
1.214 @@ -2151,8 +2172,8 @@
1.215
1.216 void attach(ListBpUGraph &_graph) {
1.217 graph = &_graph;
1.218 - node_observer_proxy.attach(graph->getNotifier(Node()));
1.219 - edge_observer_proxy.attach(graph->getNotifier(UEdge()));
1.220 + node_observer_proxy.attach(graph->notifier(Node()));
1.221 + edge_observer_proxy.attach(graph->notifier(UEdge()));
1.222 }
1.223
1.224 void detach() {