test/digraph_test.cc
branch1.2
changeset 931 c1a959df3b2c
parent 780 580af8cf2f6a
child 964 7fdaa05a69a1
equal deleted inserted replaced
18:1e52943184da 19:bc6ae990cc4f
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2010
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   390 
   390 
   391 void checkStaticDigraph() {
   391 void checkStaticDigraph() {
   392   SmartDigraph g;
   392   SmartDigraph g;
   393   SmartDigraph::NodeMap<StaticDigraph::Node> nref(g);
   393   SmartDigraph::NodeMap<StaticDigraph::Node> nref(g);
   394   SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g);
   394   SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g);
   395   
   395 
   396   StaticDigraph G;
   396   StaticDigraph G;
   397   
   397 
   398   checkGraphNodeList(G, 0);
   398   checkGraphNodeList(G, 0);
   399   checkGraphArcList(G, 0);
   399   checkGraphArcList(G, 0);
   400 
   400 
   401   G.build(g, nref, aref);
   401   G.build(g, nref, aref);
   402 
   402 
   462   arcs.push_back(std::make_pair(4,2));
   462   arcs.push_back(std::make_pair(4,2));
   463   arcs.push_back(std::make_pair(4,3));
   463   arcs.push_back(std::make_pair(4,3));
   464   arcs.push_back(std::make_pair(4,1));
   464   arcs.push_back(std::make_pair(4,1));
   465 
   465 
   466   G.build(6, arcs.begin(), arcs.end());
   466   G.build(6, arcs.begin(), arcs.end());
   467   
   467 
   468   checkGraphNodeList(G, 6);
   468   checkGraphNodeList(G, 6);
   469   checkGraphArcList(G, 9);
   469   checkGraphArcList(G, 9);
   470 
   470 
   471   checkGraphOutArcList(G, G.node(0), 2);
   471   checkGraphOutArcList(G, G.node(0), 2);
   472   checkGraphOutArcList(G, G.node(1), 2);
   472   checkGraphOutArcList(G, G.node(1), 2);
   486 
   486 
   487   checkNodeIds(G);
   487   checkNodeIds(G);
   488   checkArcIds(G);
   488   checkArcIds(G);
   489   checkGraphNodeMap(G);
   489   checkGraphNodeMap(G);
   490   checkGraphArcMap(G);
   490   checkGraphArcMap(G);
   491   
   491 
   492   int n = G.nodeNum();
   492   int n = G.nodeNum();
   493   int m = G.arcNum();
   493   int m = G.arcNum();
   494   check(G.index(G.node(n-1)) == n-1, "Wrong index.");
   494   check(G.index(G.node(n-1)) == n-1, "Wrong index.");
   495   check(G.index(G.arc(m-1)) == m-1, "Wrong index.");
   495   check(G.index(G.arc(m-1)) == m-1, "Wrong index.");
   496 }
   496 }