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 ErasableEdgeSetExtender : public _Base {
52 typedef ErasableEdgeSetExtender Graph;
55 typedef typename Parent::Edge Edge;
57 void erase(const Edge& edge) {
58 Parent::getNotifier(Edge()).erase(edge);
64 template <typename _Base>
65 class ErasableUGraphExtender : public _Base {
68 typedef ErasableUGraphExtender Graph;
71 typedef typename Parent::Node Node;
72 typedef typename Parent::UEdge UEdge;
73 typedef typename Parent::Edge Edge;
75 void erase(const Node& node) {
77 Parent::firstOut(edge, node);
78 while (edge != INVALID ) {
80 Parent::firstOut(edge, node);
83 Parent::getNotifier(Node()).erase(node);
87 void erase(const UEdge& uedge) {
88 std::vector<Edge> edges;
89 edges.push_back(Parent::direct(uedge,true));
90 edges.push_back(Parent::direct(uedge,false));
91 Parent::getNotifier(Edge()).erase(edges);
92 Parent::getNotifier(UEdge()).erase(uedge);
98 template <typename _Base>
99 class ErasableUEdgeSetExtender : public _Base {
102 typedef ErasableUEdgeSetExtender Graph;
103 typedef _Base Parent;
105 typedef typename Parent::Node Node;
106 typedef typename Parent::UEdge UEdge;
107 typedef typename Parent::Edge Edge;
109 void erase(const UEdge& uedge) {
110 std::vector<Edge> edges;
111 edges.push_back(Parent::direct(uedge,true));
112 edges.push_back(Parent::direct(uedge,false));
113 Parent::getNotifier(Edge()).erase(edges);
114 Parent::getNotifier(UEdge()).erase(uedge);
115 Parent::erase(uedge);