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 ErasableUndirGraphExtender : public _Base {
68 typedef ErasableUndirGraphExtender Graph;
71 typedef typename Parent::Node Node;
72 typedef typename Parent::UndirEdge UndirEdge;
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 UndirEdge& 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(UndirEdge()).erase(uedge);
98 template <typename _Base>
99 class ErasableUndirEdgeSetExtender : public _Base {
102 typedef ErasableUndirEdgeSetExtender Graph;
103 typedef _Base Parent;
105 typedef typename Parent::Node Node;
106 typedef typename Parent::UndirEdge UndirEdge;
107 typedef typename Parent::Edge Edge;
109 void erase(const UndirEdge& 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(UndirEdge()).erase(uedge);
115 Parent::erase(uedge);