equal
deleted
inserted
replaced
210 /* default constructor */ |
210 /* default constructor */ |
211 |
211 |
212 ListGraph() : node_id(0), edge_id(0), _node_num(0), _edge_num(0), _first_node(0), _last_node(0) { } |
212 ListGraph() : node_id(0), edge_id(0), _node_num(0), _edge_num(0), _first_node(0), _last_node(0) { } |
213 |
213 |
214 ~ListGraph() { |
214 ~ListGraph() { |
215 while (first<EachNodeIt>().valid()) deleteNode(first<EachNodeIt>()); |
215 while (first<EachNodeIt>().valid()) erase(first<EachNodeIt>()); |
216 } |
216 } |
217 |
217 |
218 int nodeNum() const { return _node_num; } |
218 int nodeNum() const { return _node_num; } |
219 int edgeNum() const { return _edge_num; } |
219 int edgeNum() const { return _edge_num; } |
220 |
220 |
291 NodeIt addNode() { return NodeIt(_add_node()); } |
291 NodeIt addNode() { return NodeIt(_add_node()); } |
292 EdgeIt addEdge(NodeIt u, NodeIt v) { |
292 EdgeIt addEdge(NodeIt u, NodeIt v) { |
293 return EdgeIt(_add_edge(u.node, v.node)); |
293 return EdgeIt(_add_edge(u.node, v.node)); |
294 } |
294 } |
295 |
295 |
296 void deleteNode(NodeIt i) { |
296 void erase(NodeIt i) { |
297 while (first<OutEdgeIt>(i).valid()) deleteEdge(first<OutEdgeIt>(i)); |
297 while (first<OutEdgeIt>(i).valid()) erase(first<OutEdgeIt>(i)); |
298 while (first<InEdgeIt>(i).valid()) deleteEdge(first<InEdgeIt>(i)); |
298 while (first<InEdgeIt>(i).valid()) erase(first<InEdgeIt>(i)); |
299 _delete_node(i.node); |
299 _delete_node(i.node); |
300 } |
300 } |
301 |
301 |
302 void deleteEdge(EdgeIt e) { _delete_edge(e.edge); } |
302 void erase(EdgeIt e) { _delete_edge(e.edge); } |
303 |
303 |
304 void setTail(EdgeIt e, NodeIt tail) { |
304 void setTail(EdgeIt e, NodeIt tail) { |
305 _set_tail(e.edge, tail.node); |
305 _set_tail(e.edge, tail.node); |
306 } |
306 } |
307 |
307 |