COIN-OR::LEMON - Graph Library

Changeset 353:37557a46e298 in lemon-1.2 for test/graph_test.cc


Ignore:
Timestamp:
08/14/08 21:49:39 (16 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Porting full graphs from svn 3498

  • the FullGraph? is redesigned in implementation
  • some improvemnts in documentation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/graph_test.cc

    r228 r353  
    2020#include <lemon/list_graph.h>
    2121#include <lemon/smart_graph.h>
    22 // #include <lemon/full_graph.h>
     22#include <lemon/full_graph.h>
    2323// #include <lemon/grid_graph.h>
    2424
     
    9696}
    9797
     98void checkFullGraph(int num) {
     99  typedef FullGraph Graph;
     100  GRAPH_TYPEDEFS(Graph);
     101
     102  Graph G(num);
     103  checkGraphNodeList(G, num);
     104  checkGraphEdgeList(G, num * (num - 1) / 2);
     105
     106  for (NodeIt n(G); n != INVALID; ++n) {
     107    checkGraphOutArcList(G, n, num - 1);   
     108    checkGraphInArcList(G, n, num - 1);   
     109    checkGraphIncEdgeList(G, n, num - 1);   
     110  }
     111
     112  checkGraphConArcList(G, num * (num - 1));
     113  checkGraphConEdgeList(G, num * (num - 1) / 2);
     114
     115  checkArcDirections(G);
     116
     117  checkNodeIds(G);
     118  checkArcIds(G);
     119  checkEdgeIds(G);
     120  checkGraphNodeMap(G);
     121  checkGraphArcMap(G);
     122  checkGraphEdgeMap(G);
     123
     124 
     125  for (int i = 0; i < G.nodeNum(); ++i) {
     126    check(G.index(G(i)) == i, "Wrong index");
     127  }
     128
     129  for (NodeIt u(G); u != INVALID; ++u) {
     130    for (NodeIt v(G); v != INVALID; ++v) {
     131      Edge e = G.edge(u, v);
     132      Arc a = G.arc(u, v);
     133      if (u == v) {
     134        check(e == INVALID, "Wrong edge lookup");
     135        check(a == INVALID, "Wrong arc lookup");
     136      } else {
     137        check((G.u(e) == u && G.v(e) == v) ||
     138              (G.u(e) == v && G.v(e) == u), "Wrong edge lookup");
     139        check(G.source(a) == u && G.target(a) == v, "Wrong arc lookup");
     140      }
     141    }
     142  }
     143}
     144
    98145void checkConcepts() {
    99146  { // Checking graph components
     
    125172    checkConcept<ClearableGraphComponent<>, SmartGraph>();
    126173  }
    127 //  { // Checking FullGraph
    128 //    checkConcept<Graph, FullGraph>();
    129 //    checkGraphIterators<FullGraph>();
    130 //  }
    131 //  { // Checking GridGraph
    132 //    checkConcept<Graph, GridGraph>();
    133 //    checkGraphIterators<GridGraph>();
    134 //  }
     174  { // Checking FullGraph
     175    checkConcept<Graph, FullGraph>();
     176  }
     177//   { // Checking GridGraph
     178//     checkConcept<Graph, GridGraph>();
     179//   }
    135180}
    136181
     
    242287    checkGraphValidity<SmartGraph>();
    243288  }
    244 //   { // Checking FullGraph
    245 //     FullGraph g(5);
    246 //     checkGraphNodeList(g, 5);
    247 //     checkGraphEdgeList(g, 10);
    248 //   }
     289  { // Checking FullGraph   
     290    checkFullGraph(7);
     291    checkFullGraph(8);
     292  }
    249293//   { // Checking GridGraph
    250294//     GridGraph g(5, 6);
Note: See TracChangeset for help on using the changeset viewer.