No segmentation fault caused by zero long edges.
3 #ifndef LEMON_ERASABLE_GRAPH_EXTENDER_H
4 #define LEMON_ERASABLE_GRAPH_EXTENDER_H
8 #include <lemon/invalid.h>
13 template <typename _Base>
14 class ErasableGraphExtender : public _Base {
17 typedef ErasableGraphExtender Graph;
20 typedef typename Parent::Node Node;
21 typedef typename Parent::Edge Edge;
23 void erase(const Node& node) {
25 Parent::firstOut(edge, node);
26 while (edge != INVALID ) {
28 Parent::firstOut(edge, node);
31 Parent::firstIn(edge, node);
32 while (edge != INVALID ) {
34 Parent::firstIn(edge, node);
37 Parent::getNotifier(Node()).erase(node);
41 void erase(const Edge& edge) {
42 Parent::getNotifier(Edge()).erase(edge);
48 template <typename _Base>
49 class ErasableUndirGraphExtender : public _Base {
52 typedef ErasableUndirGraphExtender Graph;
55 typedef typename Parent::Node Node;
56 typedef typename Parent::UndirEdge UndirEdge;
57 typedef typename Parent::Edge Edge;
59 void erase(const Node& node) {
61 Parent::firstOut(edge, node);
62 while (edge != INVALID ) {
64 Parent::firstOut(edge, node);
67 Parent::getNotifier(Node()).erase(node);
71 void erase(const UndirEdge& uedge) {
72 std::vector<Edge> edges;
73 edges.push_back(Parent::direct(uedge,true));
74 edges.push_back(Parent::direct(uedge,false));
75 Parent::getNotifier(Edge()).erase(edges);
76 Parent::getNotifier(UndirEdge()).erase(uedge);