test/graph_test.cc
branch1.1
changeset 1272 54b71c7f146d
parent 1157 761fe0846f49
child 1259 8b2d4e5d96e4
equal deleted inserted replaced
21:5fd645e21400 23:fcb5990c73cd
    61   checkGraphConEdgeList(G, 1);
    61   checkGraphConEdgeList(G, 1);
    62   checkGraphConArcList(G, 2);
    62   checkGraphConArcList(G, 2);
    63 
    63 
    64   Edge e2 = G.addEdge(n2, n1),
    64   Edge e2 = G.addEdge(n2, n1),
    65        e3 = G.addEdge(n2, n3);
    65        e3 = G.addEdge(n2, n3);
    66   ignore_unused_variable_warning(e2,e3);
    66   ::lemon::ignore_unused_variable_warning(e2,e3);
    67 
    67 
    68   checkGraphNodeList(G, 3);
    68   checkGraphNodeList(G, 3);
    69   checkGraphEdgeList(G, 3);
    69   checkGraphEdgeList(G, 3);
    70   checkGraphArcList(G, 6);
    70   checkGraphArcList(G, 6);
    71 
    71 
    94   Node n1 = G.addNode(), n2 = G.addNode(),
    94   Node n1 = G.addNode(), n2 = G.addNode(),
    95        n3 = G.addNode(), n4 = G.addNode();
    95        n3 = G.addNode(), n4 = G.addNode();
    96   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
    96   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
    97        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
    97        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
    98        e5 = G.addEdge(n4, n3);
    98        e5 = G.addEdge(n4, n3);
    99   ignore_unused_variable_warning(e1,e3,e4,e5);
    99   ::lemon::ignore_unused_variable_warning(e1,e3,e4,e5);
   100 
   100 
   101   checkGraphNodeList(G, 4);
   101   checkGraphNodeList(G, 4);
   102   checkGraphEdgeList(G, 5);
   102   checkGraphEdgeList(G, 5);
   103   checkGraphArcList(G, 10);
   103   checkGraphArcList(G, 10);
   104 
   104 
   174   Node n1 = G.addNode(), n2 = G.addNode(),
   174   Node n1 = G.addNode(), n2 = G.addNode(),
   175        n3 = G.addNode(), n4 = G.addNode();
   175        n3 = G.addNode(), n4 = G.addNode();
   176   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   176   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   177        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   177        e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
   178        e5 = G.addEdge(n4, n3);
   178        e5 = G.addEdge(n4, n3);
   179   ignore_unused_variable_warning(e1,e3,e4,e5);
   179   ::lemon::ignore_unused_variable_warning(e1,e3,e4,e5);
   180 
   180 
   181   // Check edge deletion
   181   // Check edge deletion
   182   G.erase(e2);
   182   G.erase(e2);
   183 
   183 
   184   checkGraphNodeList(G, 4);
   184   checkGraphNodeList(G, 4);
   215 
   215 
   216   Graph G;
   216   Graph G;
   217   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   217   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   218   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   218   Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
   219        e3 = G.addEdge(n2, n3);
   219        e3 = G.addEdge(n2, n3);
   220   ignore_unused_variable_warning(e1,e2,e3);
   220   ::lemon::ignore_unused_variable_warning(e1,e2,e3);
   221 
   221 
   222   checkGraphNodeList(G, 3);
   222   checkGraphNodeList(G, 3);
   223   checkGraphEdgeList(G, 3);
   223   checkGraphEdgeList(G, 3);
   224   checkGraphArcList(G, 6);
   224   checkGraphArcList(G, 6);
   225 
   225 
   364     n3 = g.addNode();
   364     n3 = g.addNode();
   365 
   365 
   366   Edge
   366   Edge
   367     e1 = g.addEdge(n1, n2),
   367     e1 = g.addEdge(n1, n2),
   368     e2 = g.addEdge(n2, n3);
   368     e2 = g.addEdge(n2, n3);
   369   ignore_unused_variable_warning(e2);
   369   ::lemon::ignore_unused_variable_warning(e2);
   370 
   370 
   371   check(g.valid(n1), "Wrong validity check");
   371   check(g.valid(n1), "Wrong validity check");
   372   check(g.valid(e1), "Wrong validity check");
   372   check(g.valid(e1), "Wrong validity check");
   373   check(g.valid(g.direct(e1, true)), "Wrong validity check");
   373   check(g.valid(g.direct(e1, true)), "Wrong validity check");
   374 
   374 
   494   checkGraphNodeList(G, 1 << dim);
   494   checkGraphNodeList(G, 1 << dim);
   495   checkGraphEdgeList(G, dim * (1 << (dim-1)));
   495   checkGraphEdgeList(G, dim * (1 << (dim-1)));
   496   checkGraphArcList(G, dim * (1 << dim));
   496   checkGraphArcList(G, dim * (1 << dim));
   497 
   497 
   498   Node n = G.nodeFromId(dim);
   498   Node n = G.nodeFromId(dim);
   499   ignore_unused_variable_warning(n);
   499   ::lemon::ignore_unused_variable_warning(n);
   500 
   500 
   501   for (NodeIt n(G); n != INVALID; ++n) {
   501   for (NodeIt n(G); n != INVALID; ++n) {
   502     checkGraphIncEdgeList(G, n, dim);
   502     checkGraphIncEdgeList(G, n, dim);
   503     for (IncEdgeIt e(G, n); e != INVALID; ++e) {
   503     for (IncEdgeIt e(G, n); e != INVALID; ++e) {
   504       check( (G.u(e) == n &&
   504       check( (G.u(e) == n &&