test/digraph_test.cc
changeset 902 d2bc45e8f6f2
parent 824 5764dd9b6e18
parent 787 819ca5b50de0
child 956 141f9c0db4a3
equal deleted inserted replaced
17:5b85e7a126af 18:1e52943184da
    34   Digraph G;
    34   Digraph G;
    35 
    35 
    36   checkGraphNodeList(G, 0);
    36   checkGraphNodeList(G, 0);
    37   checkGraphArcList(G, 0);
    37   checkGraphArcList(G, 0);
    38 
    38 
       
    39   G.reserveNode(3);
       
    40   G.reserveArc(4);
       
    41 
    39   Node
    42   Node
    40     n1 = G.addNode(),
    43     n1 = G.addNode(),
    41     n2 = G.addNode(),
    44     n2 = G.addNode(),
    42     n3 = G.addNode();
    45     n3 = G.addNode();
    43   checkGraphNodeList(G, 3);
    46   checkGraphNodeList(G, 3);
   278   checkGraphNodeMap(G);
   281   checkGraphNodeMap(G);
   279   checkGraphArcMap(G);
   282   checkGraphArcMap(G);
   280 
   283 
   281   G.addNode();
   284   G.addNode();
   282   snapshot.save(G);
   285   snapshot.save(G);
       
   286 
       
   287   G.addArc(G.addNode(), G.addNode());
       
   288 
       
   289   snapshot.restore();
       
   290   snapshot.save(G);
       
   291 
       
   292   checkGraphNodeList(G, 4);
       
   293   checkGraphArcList(G, 4);
   283 
   294 
   284   G.addArc(G.addNode(), G.addNode());
   295   G.addArc(G.addNode(), G.addNode());
   285 
   296 
   286   snapshot.restore();
   297   snapshot.restore();
   287 
   298 
   485 }
   496 }
   486 
   497 
   487 void checkFullDigraph(int num) {
   498 void checkFullDigraph(int num) {
   488   typedef FullDigraph Digraph;
   499   typedef FullDigraph Digraph;
   489   DIGRAPH_TYPEDEFS(Digraph);
   500   DIGRAPH_TYPEDEFS(Digraph);
       
   501 
   490   Digraph G(num);
   502   Digraph G(num);
       
   503   check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size");
       
   504 
       
   505   G.resize(num);
       
   506   check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size");
   491 
   507 
   492   checkGraphNodeList(G, num);
   508   checkGraphNodeList(G, num);
   493   checkGraphArcList(G, num * num);
   509   checkGraphArcList(G, num * num);
   494 
   510 
   495   for (NodeIt n(G); n != INVALID; ++n) {
   511   for (NodeIt n(G); n != INVALID; ++n) {