105 checkGraphBlueMap(G); |
105 checkGraphBlueMap(G); |
106 checkGraphArcMap(G); |
106 checkGraphArcMap(G); |
107 checkGraphEdgeMap(G); |
107 checkGraphEdgeMap(G); |
108 } |
108 } |
109 |
109 |
110 template <class Graph> |
110 template <class BpGraph> |
|
111 void checkBpGraphErase() { |
|
112 TEMPLATE_BPGRAPH_TYPEDEFS(BpGraph); |
|
113 |
|
114 BpGraph G; |
|
115 Node |
|
116 n1 = G.addRedNode(), n2 = G.addBlueNode(), |
|
117 n3 = G.addBlueNode(), n4 = G.addRedNode(); |
|
118 Edge |
|
119 e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3), |
|
120 e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3); |
|
121 |
|
122 // Check edge deletion |
|
123 G.erase(e2); |
|
124 |
|
125 checkGraphNodeList(G, 4); |
|
126 checkGraphRedNodeList(G, 2); |
|
127 checkGraphBlueNodeList(G, 2); |
|
128 checkGraphEdgeList(G, 3); |
|
129 checkGraphArcList(G, 6); |
|
130 |
|
131 checkGraphIncEdgeArcLists(G, n1, 1); |
|
132 checkGraphIncEdgeArcLists(G, n2, 2); |
|
133 checkGraphIncEdgeArcLists(G, n3, 1); |
|
134 checkGraphIncEdgeArcLists(G, n4, 2); |
|
135 |
|
136 checkGraphConEdgeList(G, 3); |
|
137 checkGraphConArcList(G, 6); |
|
138 |
|
139 // Check node deletion |
|
140 G.erase(n3); |
|
141 |
|
142 checkGraphNodeList(G, 3); |
|
143 checkGraphRedNodeList(G, 2); |
|
144 checkGraphBlueNodeList(G, 1); |
|
145 checkGraphEdgeList(G, 2); |
|
146 checkGraphArcList(G, 4); |
|
147 |
|
148 checkGraphIncEdgeArcLists(G, n1, 1); |
|
149 checkGraphIncEdgeArcLists(G, n2, 2); |
|
150 checkGraphIncEdgeArcLists(G, n4, 1); |
|
151 |
|
152 checkGraphConEdgeList(G, 2); |
|
153 checkGraphConArcList(G, 4); |
|
154 |
|
155 } |
|
156 |
|
157 template <class BpGraph> |
|
158 void checkBpGraphAlter() { |
|
159 TEMPLATE_BPGRAPH_TYPEDEFS(BpGraph); |
|
160 |
|
161 BpGraph G; |
|
162 Node |
|
163 n1 = G.addRedNode(), n2 = G.addBlueNode(), |
|
164 n3 = G.addBlueNode(), n4 = G.addRedNode(); |
|
165 Edge |
|
166 e1 = G.addEdge(n1, n2), e2 = G.addEdge(n1, n3), |
|
167 e3 = G.addEdge(n4, n2), e4 = G.addEdge(n4, n3); |
|
168 |
|
169 G.changeRed(e2, n4); |
|
170 check(G.redNode(e2) == n4, "Wrong red node"); |
|
171 check(G.blueNode(e2) == n3, "Wrong blue node"); |
|
172 |
|
173 checkGraphNodeList(G, 4); |
|
174 checkGraphRedNodeList(G, 2); |
|
175 checkGraphBlueNodeList(G, 2); |
|
176 checkGraphEdgeList(G, 4); |
|
177 checkGraphArcList(G, 8); |
|
178 |
|
179 checkGraphIncEdgeArcLists(G, n1, 1); |
|
180 checkGraphIncEdgeArcLists(G, n2, 2); |
|
181 checkGraphIncEdgeArcLists(G, n3, 2); |
|
182 checkGraphIncEdgeArcLists(G, n4, 3); |
|
183 |
|
184 checkGraphConEdgeList(G, 4); |
|
185 checkGraphConArcList(G, 8); |
|
186 |
|
187 G.changeBlue(e2, n2); |
|
188 check(G.redNode(e2) == n4, "Wrong red node"); |
|
189 check(G.blueNode(e2) == n2, "Wrong blue node"); |
|
190 |
|
191 checkGraphNodeList(G, 4); |
|
192 checkGraphRedNodeList(G, 2); |
|
193 checkGraphBlueNodeList(G, 2); |
|
194 checkGraphEdgeList(G, 4); |
|
195 checkGraphArcList(G, 8); |
|
196 |
|
197 checkGraphIncEdgeArcLists(G, n1, 1); |
|
198 checkGraphIncEdgeArcLists(G, n2, 3); |
|
199 checkGraphIncEdgeArcLists(G, n3, 1); |
|
200 checkGraphIncEdgeArcLists(G, n4, 3); |
|
201 |
|
202 checkGraphConEdgeList(G, 4); |
|
203 checkGraphConArcList(G, 8); |
|
204 } |
|
205 |
|
206 |
|
207 template <class BpGraph> |
111 void checkBpGraphSnapshot() { |
208 void checkBpGraphSnapshot() { |
112 TEMPLATE_BPGRAPH_TYPEDEFS(Graph); |
209 TEMPLATE_BPGRAPH_TYPEDEFS(BpGraph); |
113 |
210 |
114 Graph G; |
211 BpGraph G; |
115 Node |
212 Node |
116 n1 = G.addRedNode(), |
213 n1 = G.addRedNode(), |
117 n2 = G.addBlueNode(), |
214 n2 = G.addBlueNode(), |
118 n3 = G.addBlueNode(); |
215 n3 = G.addBlueNode(); |
119 Edge |
216 Edge |