equal
deleted
inserted
replaced
152 } |
152 } |
153 |
153 |
154 void first(Edge& edge) const { |
154 void first(Edge& edge) const { |
155 Node node; |
155 Node node; |
156 for (first(node); node != INVALID && (*nodes)[node].first_in == -1; |
156 for (first(node); node != INVALID && (*nodes)[node].first_in == -1; |
157 next(node)); |
157 next(node)) { } |
158 edge.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; |
158 edge.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; |
159 } |
159 } |
160 |
160 |
161 void next(Edge& edge) const { |
161 void next(Edge& edge) const { |
162 if (edges[edge.id].next_in != -1) { |
162 if (edges[edge.id].next_in != -1) { |
163 edge.id = edges[edge.id].next_in; |
163 edge.id = edges[edge.id].next_in; |
164 } else { |
164 } else { |
165 Node node = edges[edge.id].target; |
165 Node node = edges[edge.id].target; |
166 for (next(node); node != INVALID && (*nodes)[node].first_in == -1; |
166 for (next(node); node != INVALID && (*nodes)[node].first_in == -1; |
167 next(node)); |
167 next(node)) { } |
168 edge.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; |
168 edge.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; |
169 } |
169 } |
170 } |
170 } |
171 |
171 |
172 void firstOut(Edge& edge, const Node& node) const { |
172 void firstOut(Edge& edge, const Node& node) const { |