COIN-OR::LEMON - Graph Library

Ignore:
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/Makefile.am

    r361 r368  
    2929        lemon/dim2.h \
    3030        lemon/error.h \
     31        lemon/full_graph.h \
    3132        lemon/graph_to_eps.h \
    3233        lemon/grid_graph.h \
  • test/digraph_test.cc

    r228 r366  
    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/hypercube_graph.h>
    2424
     
    8080}
    8181
     82void checkFullDigraph(int num) {
     83  typedef FullDigraph Digraph;
     84  DIGRAPH_TYPEDEFS(Digraph);
     85  Digraph G(num);
     86
     87  checkGraphNodeList(G, num);
     88  checkGraphArcList(G, num * num);
     89
     90  for (NodeIt n(G); n != INVALID; ++n) {
     91    checkGraphOutArcList(G, n, num);
     92    checkGraphInArcList(G, n, num);
     93  }
     94
     95  checkGraphConArcList(G, num * num);
     96
     97  checkNodeIds(G);
     98  checkArcIds(G);
     99  checkGraphNodeMap(G);
     100  checkGraphArcMap(G);
     101
     102  for (int i = 0; i < G.nodeNum(); ++i) {
     103    check(G.index(G(i)) == i, "Wrong index");
     104  }
     105
     106  for (NodeIt s(G); s != INVALID; ++s) {
     107    for (NodeIt t(G); t != INVALID; ++t) {
     108      Arc a = G.arc(s, t);
     109      check(G.source(a) == s && G.target(a) == t, "Wrong arc lookup");
     110    }
     111  }
     112
     113}
     114
    82115
    83116void checkConcepts() {
     
    110143    checkConcept<ClearableDigraphComponent<>, SmartDigraph>();
    111144  }
    112 //  { // Checking FullDigraph
    113 //    checkConcept<Digraph, FullDigraph>();
    114 //  }
     145  { // Checking FullDigraph
     146    checkConcept<Digraph, FullDigraph>();
     147  }
    115148//  { // Checking HyperCubeDigraph
    116149//    checkConcept<Digraph, HyperCubeDigraph>();
     
    177210    checkDigraphValidity<SmartDigraph>();
    178211  }
     212  { // Checking FullDigraph
     213    checkFullDigraph(8);
     214  }
    179215}
    180216
  • test/graph_test.cc

    r348 r368  
    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 //  }
     174  { // Checking FullGraph
     175    checkConcept<Graph, FullGraph>();
     176  }
    131177  { // Checking GridGraph
    132178    checkConcept<Graph, GridGraph>();
     
    276322    checkGraphValidity<SmartGraph>();
    277323  }
    278 //   { // Checking FullGraph
    279 //     FullGraph g(5);
    280 //     checkGraphNodeList(g, 5);
    281 //     checkGraphEdgeList(g, 10);
    282 //   }
     324  { // Checking FullGraph   
     325    checkFullGraph(7);
     326    checkFullGraph(8);
     327  }
    283328  { // Checking GridGraph
    284329    checkGridGraph(5, 8);
Note: See TracChangeset for help on using the changeset viewer.