test/graph_test.cc
changeset 1146 81f70097df81
parent 998 7fdaa05a69a1
parent 1083 3e711ee55d31
child 1092 dceba191c00d
equal deleted inserted replaced
22:dfffbd94d230 24:81234e4e8933
    64   checkGraphConEdgeList(G, 1);
    64   checkGraphConEdgeList(G, 1);
    65   checkGraphConArcList(G, 2);
    65   checkGraphConArcList(G, 2);
    66 
    66 
    67   Edge e2 = G.addEdge(n2, n1),
    67   Edge e2 = G.addEdge(n2, n1),
    68        e3 = G.addEdge(n2, n3);
    68        e3 = G.addEdge(n2, n3);
    69   ignore_unused_variable_warning(e2,e3);
    69   ::lemon::ignore_unused_variable_warning(e2,e3);
    70 
    70 
    71   checkGraphNodeList(G, 3);
    71   checkGraphNodeList(G, 3);
    72   checkGraphEdgeList(G, 3);
    72   checkGraphEdgeList(G, 3);
    73   checkGraphArcList(G, 6);
    73   checkGraphArcList(G, 6);
    74 
    74 
    97   Node n1 = G.addNode(), n2 = G.addNode(),
    97   Node n1 = G.addNode(), n2 = G.addNode(),
    98        n3 = G.addNode(), n4 = G.addNode();
    98        n3 = G.addNode(), n4 = G.addNode();
    99   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
    99   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   100        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   100        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   101        e5 = G.addEdge(n4, n3);
   101        e5 = G.addEdge(n4, n3);
   102   ignore_unused_variable_warning(e1,e3,e4,e5);
   102   ::lemon::ignore_unused_variable_warning(e1,e3,e4,e5);
   103 
   103 
   104   checkGraphNodeList(G, 4);
   104   checkGraphNodeList(G, 4);
   105   checkGraphEdgeList(G, 5);
   105   checkGraphEdgeList(G, 5);
   106   checkGraphArcList(G, 10);
   106   checkGraphArcList(G, 10);
   107 
   107 
   177   Node n1 = G.addNode(), n2 = G.addNode(),
   177   Node n1 = G.addNode(), n2 = G.addNode(),
   178        n3 = G.addNode(), n4 = G.addNode();
   178        n3 = G.addNode(), n4 = G.addNode();
   179   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   179   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   180        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   180        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   181        e5 = G.addEdge(n4, n3);
   181        e5 = G.addEdge(n4, n3);
   182   ignore_unused_variable_warning(e1,e3,e4,e5);
   182   ::lemon::ignore_unused_variable_warning(e1,e3,e4,e5);
   183 
   183 
   184   // Check edge deletion
   184   // Check edge deletion
   185   G.erase(e2);
   185   G.erase(e2);
   186 
   186 
   187   checkGraphNodeList(G, 4);
   187   checkGraphNodeList(G, 4);
   218 
   218 
   219   Graph G;
   219   Graph G;
   220   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   220   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   221   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   221   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   222        e3 = G.addEdge(n2, n3);
   222        e3 = G.addEdge(n2, n3);
   223   ignore_unused_variable_warning(e1,e2,e3);
   223   ::lemon::ignore_unused_variable_warning(e1,e2,e3);
   224 
   224 
   225   checkGraphNodeList(G, 3);
   225   checkGraphNodeList(G, 3);
   226   checkGraphEdgeList(G, 3);
   226   checkGraphEdgeList(G, 3);
   227   checkGraphArcList(G, 6);
   227   checkGraphArcList(G, 6);
   228 
   228 
   383     n3 = g.addNode();
   383     n3 = g.addNode();
   384 
   384 
   385   Edge
   385   Edge
   386     e1 = g.addEdge(n1, n2),
   386     e1 = g.addEdge(n1, n2),
   387     e2 = g.addEdge(n2, n3);
   387     e2 = g.addEdge(n2, n3);
   388   ignore_unused_variable_warning(e2);
   388   ::lemon::ignore_unused_variable_warning(e2);
   389 
   389 
   390   check(g.valid(n1), "Wrong validity check");
   390   check(g.valid(n1), "Wrong validity check");
   391   check(g.valid(e1), "Wrong validity check");
   391   check(g.valid(e1), "Wrong validity check");
   392   check(g.valid(g.direct(e1, true)), "Wrong validity check");
   392   check(g.valid(g.direct(e1, true)), "Wrong validity check");
   393 
   393 
   522   checkGraphNodeList(G, 1 << dim);
   522   checkGraphNodeList(G, 1 << dim);
   523   checkGraphEdgeList(G, dim * (1 << (dim-1)));
   523   checkGraphEdgeList(G, dim * (1 << (dim-1)));
   524   checkGraphArcList(G, dim * (1 << dim));
   524   checkGraphArcList(G, dim * (1 << dim));
   525 
   525 
   526   Node n = G.nodeFromId(dim);
   526   Node n = G.nodeFromId(dim);
   527   ignore_unused_variable_warning(n);
   527   ::lemon::ignore_unused_variable_warning(n);
   528 
   528 
   529   for (NodeIt n(G); n != INVALID; ++n) {
   529   for (NodeIt n(G); n != INVALID; ++n) {
   530     checkGraphIncEdgeList(G, n, dim);
   530     checkGraphIncEdgeList(G, n, dim);
   531     for (IncEdgeIt e(G, n); e != INVALID; ++e) {
   531     for (IncEdgeIt e(G, n); e != INVALID; ++e) {
   532       check( (G.u(e) == n &&
   532       check( (G.u(e) == n &&