3 #ifndef LEMON_EXTENDABLE_GRAPH_EXTENDER_H
4 #define LEMON_EXTENDABLE_GRAPH_EXTENDER_H
8 template <typename _Base>
9 class ExtendableGraphExtender : public _Base {
12 typedef ExtendableGraphExtender Graph;
15 typedef typename Parent::Node Node;
16 typedef typename Parent::Edge Edge;
19 Node node = Parent::addNode();
20 Parent::getNotifier(Node()).add(node);
24 Edge addEdge(const Node& from, const Node& to) {
25 Edge edge = Parent::addEdge(from, to);
26 Parent::getNotifier(Edge()).add(edge);
32 template <typename _Base>
33 class ExtendableEdgeSetExtender : public _Base {
36 typedef ExtendableEdgeSetExtender Graph;
39 typedef typename Parent::Edge Edge;
40 typedef typename Parent::Node Node;
42 Edge addEdge(const Node& from, const Node& to) {
43 Edge edge = Parent::addEdge(from, to);
44 Parent::getNotifier(Edge()).add(edge);
50 template <typename _Base>
51 class ExtendableUGraphExtender : public _Base {
54 typedef ExtendableUGraphExtender Graph;
57 typedef typename Parent::Node Node;
58 typedef typename Parent::Edge Edge;
59 typedef typename Parent::UEdge UEdge;
62 Node node = Parent::addNode();
63 Parent::getNotifier(Node()).add(node);
67 UEdge addEdge(const Node& from, const Node& to) {
68 UEdge uedge = Parent::addEdge(from, to);
69 Parent::getNotifier(UEdge()).add(uedge);
71 std::vector<Edge> edges;
72 edges.push_back(Parent::direct(uedge, true));
73 edges.push_back(Parent::direct(uedge, false));
74 Parent::getNotifier(Edge()).add(edges);
81 template <typename _Base>
82 class ExtendableUEdgeSetExtender : public _Base {
85 typedef ExtendableUEdgeSetExtender Graph;
88 typedef typename Parent::Node Node;
89 typedef typename Parent::Edge Edge;
90 typedef typename Parent::UEdge UEdge;
92 UEdge addEdge(const Node& from, const Node& to) {
93 UEdge uedge = Parent::addEdge(from, to);
94 Parent::getNotifier(UEdge()).add(uedge);
96 std::vector<Edge> edges;
97 edges.push_back(Parent::direct(uedge, true));
98 edges.push_back(Parent::direct(uedge, false));
99 Parent::getNotifier(Edge()).add(edges);
107 template <typename _Base>
108 class ExtendableBpUGraphExtender : public _Base {
111 typedef _Base Parent;
112 typedef ExtendableBpUGraphExtender Graph;
114 typedef typename Parent::Node Node;
115 typedef typename Parent::BNode BNode;
116 typedef typename Parent::ANode ANode;
117 typedef typename Parent::Edge Edge;
118 typedef typename Parent::UEdge UEdge;
121 Node node = Parent::addANode();
122 Parent::getNotifier(ANode()).add(node);
123 Parent::getNotifier(Node()).add(node);
128 Node node = Parent::addBNode();
129 Parent::getNotifier(BNode()).add(node);
130 Parent::getNotifier(Node()).add(node);
134 UEdge addEdge(const Node& source, const Node& target) {
135 UEdge uedge = Parent::addEdge(source, target);
136 Parent::getNotifier(UEdge()).add(uedge);
138 std::vector<Edge> edges;
139 edges.push_back(Parent::direct(uedge, true));
140 edges.push_back(Parent::direct(uedge, false));
141 Parent::getNotifier(Edge()).add(edges);