test/vf2_test.cc
author Peter Kovacs <kpeter@inf.elte.hu>
Sat, 07 Oct 2017 16:22:04 +0200
changeset 1412 3ca508482e4c
parent 1405 3feba0ea1bda
permissions -rw-r--r--
Change misleading method name in Vf2pp (#597)

It processes an entire connected component of the graph _g1 using BFS,
so processBfsTree() is more appropriate name than processBFSLevel().
madarasip@1350
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
madarasip@1350
     2
 *
madarasip@1350
     3
 * This file is a part of LEMON, a generic C++ optimization library.
madarasip@1350
     4
 *
madarasip@1405
     5
 * Copyright (C) 2015-2017
madarasip@1350
     6
 * EMAXA Kutato-fejleszto Kft. (EMAXA Research Ltd.)
madarasip@1350
     7
 *
madarasip@1350
     8
 * Permission to use, modify and distribute this software is granted
madarasip@1350
     9
 * provided that this copyright notice appears in all copies. For
madarasip@1350
    10
 * precise terms see the accompanying LICENSE file.
madarasip@1350
    11
 *
madarasip@1350
    12
 * This software is provided "AS IS" with no warranty of any kind,
madarasip@1350
    13
 * express or implied, and with no claim as to its suitability for any
madarasip@1350
    14
 * purpose.
madarasip@1350
    15
 *
madarasip@1350
    16
 */
madarasip@1350
    17
madarasip@1350
    18
#include <lemon/vf2.h>
kpeter@1406
    19
#include <lemon/vf2pp.h>
madarasip@1350
    20
#include <lemon/concepts/digraph.h>
madarasip@1350
    21
#include <lemon/smart_graph.h>
madarasip@1350
    22
#include <lemon/lgf_reader.h>
madarasip@1350
    23
#include <lemon/concepts/maps.h>
madarasip@1350
    24
madarasip@1350
    25
#include <test/test_tools.h>
madarasip@1350
    26
#include <sstream>
madarasip@1350
    27
madarasip@1350
    28
using namespace lemon;
madarasip@1350
    29
madarasip@1350
    30
char petersen_lgf[] =
madarasip@1350
    31
  "@nodes\n"
madarasip@1350
    32
  "label col1 col2\n"
madarasip@1350
    33
  "0 1 1\n"
madarasip@1350
    34
  "1 1 2\n"
madarasip@1350
    35
  "2 1 3\n"
madarasip@1350
    36
  "3 1 4\n"
madarasip@1350
    37
  "4 2 5\n"
madarasip@1350
    38
  "5 2 1\n"
madarasip@1350
    39
  "6 2 2\n"
madarasip@1350
    40
  "7 2 3\n"
madarasip@1350
    41
  "8 2 4\n"
madarasip@1350
    42
  "9 2 5\n"
madarasip@1350
    43
  "@arcs\n"
madarasip@1350
    44
  "     -\n"
madarasip@1350
    45
  "0 1\n"
madarasip@1350
    46
  "1 2\n"
madarasip@1350
    47
  "2 3\n"
madarasip@1350
    48
  "3 4\n"
madarasip@1350
    49
  "4 0\n"
madarasip@1350
    50
  "0 5\n"
madarasip@1350
    51
  "1 6\n"
madarasip@1350
    52
  "2 7\n"
madarasip@1350
    53
  "3 8\n"
madarasip@1350
    54
  "4 9\n"
madarasip@1350
    55
  "5 8\n"
madarasip@1350
    56
  "5 7\n"
madarasip@1350
    57
  "9 6\n"
madarasip@1350
    58
  "9 7\n"
madarasip@1350
    59
  "6 8\n";
madarasip@1350
    60
madarasip@1350
    61
char c5_lgf[] =
madarasip@1350
    62
  "@nodes\n"
madarasip@1350
    63
  "label col\n"
madarasip@1350
    64
  "0 1\n"
madarasip@1350
    65
  "1 2\n"
madarasip@1350
    66
  "2 3\n"
madarasip@1350
    67
  "3 4\n"
madarasip@1350
    68
  "4 5\n"
madarasip@1350
    69
  "@arcs\n"
madarasip@1350
    70
  "     -\n"
madarasip@1350
    71
  "0 1\n"
madarasip@1350
    72
  "1 2\n"
madarasip@1350
    73
  "2 3\n"
madarasip@1350
    74
  "3 4\n"
madarasip@1350
    75
  "4 0\n";
madarasip@1350
    76
madarasip@1350
    77
char c7_lgf[] =
madarasip@1350
    78
  "@nodes\n"
madarasip@1350
    79
  "label\n"
madarasip@1350
    80
  "0\n"
madarasip@1350
    81
  "1\n"
madarasip@1350
    82
  "2\n"
madarasip@1350
    83
  "3\n"
madarasip@1350
    84
  "4\n"
madarasip@1350
    85
  "5\n"
madarasip@1350
    86
  "6\n"
madarasip@1350
    87
  "@arcs\n"
madarasip@1350
    88
  "     -\n"
madarasip@1350
    89
  "0 1\n"
madarasip@1350
    90
  "1 2\n"
madarasip@1350
    91
  "2 3\n"
madarasip@1350
    92
  "3 4\n"
madarasip@1350
    93
  "4 5\n"
madarasip@1350
    94
  "5 6\n"
madarasip@1350
    95
  "6 0\n";
madarasip@1350
    96
madarasip@1350
    97
char c10_lgf[] =
madarasip@1350
    98
  "@nodes\n"
madarasip@1350
    99
  "label\n"
madarasip@1350
   100
  "0\n"
madarasip@1350
   101
  "1\n"
madarasip@1350
   102
  "2\n"
madarasip@1350
   103
  "3\n"
madarasip@1350
   104
  "4\n"
madarasip@1350
   105
  "5\n"
madarasip@1350
   106
  "6\n"
madarasip@1350
   107
  "7\n"
madarasip@1350
   108
  "8\n"
madarasip@1350
   109
  "9\n"
madarasip@1350
   110
  "@arcs\n"
madarasip@1350
   111
  "     -\n"
madarasip@1350
   112
  "0 1\n"
madarasip@1350
   113
  "1 2\n"
madarasip@1350
   114
  "2 3\n"
madarasip@1350
   115
  "3 4\n"
madarasip@1350
   116
  "4 5\n"
madarasip@1350
   117
  "5 6\n"
madarasip@1350
   118
  "6 7\n"
madarasip@1350
   119
  "7 8\n"
madarasip@1350
   120
  "8 9\n"
madarasip@1350
   121
  "9 0\n";
madarasip@1350
   122
madarasip@1350
   123
char p10_lgf[] =
madarasip@1350
   124
  "@nodes\n"
madarasip@1350
   125
  "label\n"
madarasip@1350
   126
  "0\n"
madarasip@1350
   127
  "1\n"
madarasip@1350
   128
  "2\n"
madarasip@1350
   129
  "3\n"
madarasip@1350
   130
  "4\n"
madarasip@1350
   131
  "5\n"
madarasip@1350
   132
  "6\n"
madarasip@1350
   133
  "7\n"
madarasip@1350
   134
  "8\n"
madarasip@1350
   135
  "9\n"
madarasip@1350
   136
  "@arcs\n"
madarasip@1350
   137
  "     -\n"
madarasip@1350
   138
  "0 1\n"
madarasip@1350
   139
  "1 2\n"
madarasip@1350
   140
  "2 3\n"
madarasip@1350
   141
  "3 4\n"
madarasip@1350
   142
  "4 5\n"
madarasip@1350
   143
  "5 6\n"
madarasip@1350
   144
  "6 7\n"
madarasip@1350
   145
  "7 8\n"
madarasip@1350
   146
  "8 9\n";
madarasip@1350
   147
madarasip@1350
   148
SmartGraph petersen, c5, c7, c10, p10;
madarasip@1350
   149
SmartGraph::NodeMap<int> petersen_col1(petersen);
madarasip@1350
   150
SmartGraph::NodeMap<int> petersen_col2(petersen);
madarasip@1350
   151
SmartGraph::NodeMap<int> c5_col(c5);
madarasip@1350
   152
madarasip@1350
   153
void make_graphs() {
madarasip@1350
   154
  std::stringstream ss(petersen_lgf);
madarasip@1350
   155
  graphReader(petersen, ss)
kpeter@1406
   156
    .nodeMap("col1", petersen_col1)
kpeter@1406
   157
    .nodeMap("col2", petersen_col2)
madarasip@1350
   158
    .run();
madarasip@1350
   159
madarasip@1350
   160
  ss.clear();
madarasip@1350
   161
  ss.str("");
kpeter@1406
   162
  ss << c5_lgf;
madarasip@1350
   163
  //std::stringstream ss2(c5_lgf);
madarasip@1350
   164
  graphReader(c5, ss)
kpeter@1406
   165
    .nodeMap("col", c5_col)
madarasip@1350
   166
    .run();
madarasip@1350
   167
madarasip@1350
   168
  ss.clear();
madarasip@1350
   169
  ss.str("");
kpeter@1406
   170
  ss << c7_lgf;
madarasip@1350
   171
  graphReader(c7, ss).run();
madarasip@1350
   172
madarasip@1350
   173
  ss.clear();
madarasip@1350
   174
  ss.str("");
kpeter@1406
   175
  ss << c10_lgf;
madarasip@1350
   176
  graphReader(c10, ss).run();
madarasip@1350
   177
madarasip@1350
   178
  ss.clear();
madarasip@1350
   179
  ss.str("");
kpeter@1406
   180
  ss << p10_lgf;
madarasip@1350
   181
  graphReader(p10, ss).run();
madarasip@1350
   182
madarasip@1350
   183
}
madarasip@1350
   184
madarasip@1350
   185
class EqComparable {
madarasip@1350
   186
public:
madarasip@1405
   187
  bool operator==(const EqComparable&) {
madarasip@1405
   188
    return false;
madarasip@1405
   189
  }
madarasip@1350
   190
};
madarasip@1350
   191
madarasip@1350
   192
template<class A, class B>
madarasip@1350
   193
class EqClass {
madarasip@1350
   194
public:
madarasip@1405
   195
  bool operator()(A, B){
madarasip@1405
   196
    return false;
madarasip@1405
   197
  }
madarasip@1350
   198
};
madarasip@1350
   199
kpeter@1406
   200
class IntConvertible1 {
kpeter@1406
   201
public:
kpeter@1406
   202
  operator int() {
kpeter@1406
   203
    return 0;
kpeter@1406
   204
  }
kpeter@1406
   205
};
kpeter@1406
   206
kpeter@1406
   207
class IntConvertible2 {
kpeter@1406
   208
public:
kpeter@1406
   209
  operator int() {
kpeter@1406
   210
    return 0;
kpeter@1406
   211
  }
kpeter@1406
   212
};
kpeter@1406
   213
madarasip@1350
   214
template<class G1,class G2>
madarasip@1405
   215
void checkVf2Compile() {
madarasip@1350
   216
  G1 g;
madarasip@1350
   217
  G2 h;
madarasip@1350
   218
  concepts::ReadWriteMap<typename G1::Node, typename G2::Node> r;
madarasip@1350
   219
  bool succ;
madarasip@1350
   220
  ::lemon::ignore_unused_variable_warning(succ);
madarasip@1350
   221
madarasip@1350
   222
  succ = vf2(g,h).run();
madarasip@1350
   223
  succ = vf2(g,h).induced().run();
madarasip@1350
   224
  succ = vf2(g,h).iso().run();
madarasip@1350
   225
  succ = vf2(g,h).mapping(r).run();
madarasip@1405
   226
madarasip@1405
   227
  Vf2<G1,G2,concepts::ReadWriteMap<typename G1::Node, typename G2::Node>,
madarasip@1405
   228
      EqClass<typename G1::Node,typename G2::Node> >
madarasip@1405
   229
    myVf2(g,h,r,EqClass<typename G1::Node,typename G2::Node>());
madarasip@1405
   230
  myVf2.find();
madarasip@1405
   231
madarasip@1350
   232
  succ = vf2(g,h).induced().mapping(r).run();
madarasip@1350
   233
  succ = vf2(g,h).iso().mapping(r).run();
madarasip@1405
   234
madarasip@1350
   235
  concepts::ReadMap<typename G1::Node, EqComparable> l1;
madarasip@1350
   236
  concepts::ReadMap<typename G2::Node, EqComparable> l2;
madarasip@1350
   237
  succ = vf2(g,h).nodeLabels(l1,l2).mapping(r).run();
madarasip@1350
   238
  succ = vf2(g,h).nodeEq(EqClass<typename G1::Node,typename G2::Node>())
madarasip@1350
   239
    .mapping(r).run();
madarasip@1350
   240
}
madarasip@1350
   241
kpeter@1406
   242
void vf2Compile() {
madarasip@1350
   243
  checkVf2Compile<concepts::Graph,concepts::Graph>();
madarasip@1350
   244
  checkVf2Compile<concepts::Graph,SmartGraph>();
madarasip@1350
   245
  checkVf2Compile<SmartGraph,concepts::Graph>();
madarasip@1350
   246
}
madarasip@1350
   247
kpeter@1406
   248
template<class G1,class G2>
kpeter@1406
   249
void checkVf2ppCompile() {
kpeter@1406
   250
  G1 g;
kpeter@1406
   251
  G2 h;
kpeter@1406
   252
  concepts::ReadWriteMap<typename G1::Node, typename G2::Node> r;
kpeter@1406
   253
  bool succ;
kpeter@1406
   254
  ::lemon::ignore_unused_variable_warning(succ);
kpeter@1406
   255
kpeter@1406
   256
  succ = vf2pp(g,h).run();
kpeter@1406
   257
  succ = vf2pp(g,h).induced().run();
kpeter@1406
   258
  succ = vf2pp(g,h).iso().run();
kpeter@1406
   259
  succ = vf2pp(g,h).mapping(r).run();
kpeter@1406
   260
  succ = vf2pp(g,h).induced().mapping(r).run();
kpeter@1406
   261
  succ = vf2pp(g,h).iso().mapping(r).run();
kpeter@1406
   262
kpeter@1406
   263
  concepts::ReadMap<typename G1::Node, int> c1;
kpeter@1406
   264
  concepts::ReadMap<typename G2::Node, int> c2;
kpeter@1406
   265
  Vf2pp<G1,G2,concepts::ReadWriteMap<typename G1::Node, typename G2::Node>,
kpeter@1406
   266
        concepts::ReadMap<typename G1::Node, int>,
kpeter@1406
   267
        concepts::ReadMap<typename G2::Node, int> >
kpeter@1406
   268
    myVf2pp(g,h,r,c1,c2);
kpeter@1406
   269
  myVf2pp.find();
kpeter@1406
   270
kpeter@1406
   271
  succ = vf2pp(g,h).nodeLabels(c1,c2).mapping(r).run();
kpeter@1406
   272
  succ = vf2pp(g,h).nodeLabels(c1,c2).mapping(r).run();
kpeter@1406
   273
kpeter@1406
   274
  concepts::ReadMap<typename G1::Node, char> c1_c;
kpeter@1406
   275
  concepts::ReadMap<typename G2::Node, char> c2_c;
kpeter@1406
   276
  Vf2pp<G1,G2,concepts::ReadWriteMap<typename G1::Node, typename G2::Node>,
kpeter@1406
   277
        concepts::ReadMap<typename G1::Node, char>,
kpeter@1406
   278
        concepts::ReadMap<typename G2::Node, char> >
kpeter@1406
   279
    myVf2pp_c(g,h,r,c1_c,c2_c);
kpeter@1406
   280
  myVf2pp_c.find();
kpeter@1406
   281
kpeter@1406
   282
  succ = vf2pp(g,h).nodeLabels(c1_c,c2_c).mapping(r).run();
kpeter@1406
   283
  succ = vf2pp(g,h).nodeLabels(c1_c,c2_c).mapping(r).run();
kpeter@1406
   284
kpeter@1406
   285
  concepts::ReadMap<typename G1::Node, IntConvertible1> c1_IntConv;
kpeter@1406
   286
  concepts::ReadMap<typename G2::Node, IntConvertible2> c2_IntConv;
kpeter@1406
   287
  Vf2pp<G1,G2,concepts::ReadWriteMap<typename G1::Node, typename G2::Node>,
kpeter@1406
   288
        concepts::ReadMap<typename G1::Node, IntConvertible1>,
kpeter@1406
   289
        concepts::ReadMap<typename G2::Node, IntConvertible2> >
kpeter@1406
   290
    myVf2pp_IntConv(g,h,r,c1_IntConv,c2_IntConv);
kpeter@1406
   291
  myVf2pp_IntConv.find();
kpeter@1406
   292
kpeter@1406
   293
  succ = vf2pp(g,h).nodeLabels(c1_IntConv,c2_IntConv).mapping(r).run();
kpeter@1406
   294
  succ = vf2pp(g,h).nodeLabels(c1_IntConv,c2_IntConv).mapping(r).run();
kpeter@1406
   295
}
kpeter@1406
   296
kpeter@1406
   297
void vf2ppCompile() {
kpeter@1406
   298
  checkVf2ppCompile<concepts::Graph,concepts::Graph>();
kpeter@1406
   299
  checkVf2ppCompile<concepts::Graph,SmartGraph>();
kpeter@1406
   300
  checkVf2ppCompile<SmartGraph,concepts::Graph>();
madarasip@1350
   301
}
madarasip@1350
   302
madarasip@1350
   303
template<class G1, class G2, class I>
kpeter@1406
   304
void checkSubIso(const G1 &g1, const G2 &g2, const I &i) {
madarasip@1350
   305
  std::set<typename G2::Node> image;
kpeter@1406
   306
  for (typename G1::NodeIt n(g1);n!=INVALID;++n){
madarasip@1350
   307
    check(i[n]!=INVALID, "Wrong isomorphism: incomplete mapping.");
madarasip@1350
   308
    check(image.count(i[n])==0,"Wrong isomorphism: not injective.");
madarasip@1350
   309
    image.insert(i[n]);
madarasip@1405
   310
  }
kpeter@1406
   311
  for (typename G1::EdgeIt e(g1);e!=INVALID;++e) {
kpeter@1406
   312
    check(findEdge(g2,i[g1.u(e)],i[g1.v(e)])!=INVALID,
kpeter@1406
   313
          "Wrong isomorphism: missing edge(checkSub).");
kpeter@1406
   314
  }
kpeter@1406
   315
}
kpeter@1406
   316
kpeter@1406
   317
template<class G1, class G2, class I>
kpeter@1406
   318
void checkIndIso(const G1 &g1, const G2 &g2, const I &i) {
kpeter@1406
   319
  std::set<typename G2::Node> image;
kpeter@1406
   320
  for (typename G1::NodeIt n(g1);n!=INVALID;++n) {
kpeter@1406
   321
    check(i[n]!=INVALID, "Wrong isomorphism: incomplete mapping.");
kpeter@1406
   322
    check(image.count(i[n])==0,"Wrong isomorphism: not injective.");
kpeter@1406
   323
    image.insert(i[n]);
kpeter@1406
   324
  }
kpeter@1406
   325
  for (typename G1::NodeIt n(g1); n!=INVALID; ++n) {
kpeter@1406
   326
    for (typename G1::NodeIt m(g1); m!=INVALID; ++m) {
madarasip@1405
   327
      if((findEdge(g1,n,m)==INVALID) != (findEdge(g2,i[n],i[m])==INVALID)) {
madarasip@1350
   328
        std::cout << "Wrong isomorphism: edge mismatch";
madarasip@1350
   329
        exit(1);
madarasip@1405
   330
      }
kpeter@1406
   331
    }
kpeter@1406
   332
  }
madarasip@1350
   333
}
madarasip@1350
   334
kpeter@1406
   335
template<class G1,class G2,class T>
kpeter@1406
   336
bool checkSub(const G1 &g1, const G2 &g2, const T &vf2) {
madarasip@1350
   337
  typename G1:: template NodeMap<typename G2::Node> iso(g1,INVALID);
kpeter@1406
   338
  if (const_cast<T&>(vf2).mapping(iso).run()) {
kpeter@1406
   339
    checkSubIso(g1,g2,iso);
madarasip@1405
   340
    return true;
madarasip@1405
   341
  }
kpeter@1406
   342
  return false;
madarasip@1350
   343
}
madarasip@1350
   344
kpeter@1406
   345
template<class G1,class G2,class T>
kpeter@1406
   346
bool checkInd(const G1 &g1, const G2 &g2, const T &vf2) {
madarasip@1350
   347
  typename G1:: template NodeMap<typename G2::Node> iso(g1,INVALID);
kpeter@1406
   348
  if (const_cast<T&>(vf2).induced().mapping(iso).run()) {
kpeter@1406
   349
    checkIndIso(g1,g2,iso);
madarasip@1405
   350
    return true;
madarasip@1405
   351
  }
kpeter@1406
   352
  return false;
madarasip@1405
   353
}
madarasip@1405
   354
kpeter@1406
   355
template<class G1,class G2,class T>
kpeter@1406
   356
bool checkIso(const G1 &g1, const G2 &g2, const T &vf2) {
madarasip@1405
   357
  typename G1:: template NodeMap<typename G2::Node> iso(g1,INVALID);
kpeter@1406
   358
  if (const_cast<T&>(vf2).iso().mapping(iso).run()) {
madarasip@1405
   359
    check(countNodes(g1)==countNodes(g2),
madarasip@1405
   360
          "Wrong iso alg.: they are not isomophic.");
kpeter@1406
   361
    checkIndIso(g1,g2,iso);
madarasip@1405
   362
    return true;
madarasip@1405
   363
  }
kpeter@1406
   364
  return false;
madarasip@1350
   365
}
madarasip@1350
   366
madarasip@1350
   367
template<class G1, class G2, class L1, class L2, class I>
madarasip@1350
   368
void checkLabel(const G1 &g1, const G2 &,
kpeter@1406
   369
                const L1 &l1, const L2 &l2, const I &i) {
kpeter@1406
   370
  for (typename G1::NodeIt n(g1);n!=INVALID;++n) {
madarasip@1405
   371
    check(l1[n]==l2[i[n]],"Wrong isomorphism: label mismatch.");
kpeter@1406
   372
  }
kpeter@1406
   373
}
kpeter@1406
   374
kpeter@1406
   375
template<class G1,class G2,class L1,class L2,class T>
kpeter@1406
   376
bool checkSub(const G1 &g1, const G2 &g2, const L1 &l1, const L2 &l2, const T &vf2) {
kpeter@1406
   377
  typename G1:: template NodeMap<typename G2::Node> iso(g1,INVALID);
kpeter@1406
   378
  if (const_cast<T&>(vf2).nodeLabels(l1,l2).mapping(iso).run()){
kpeter@1406
   379
    checkSubIso(g1,g2,iso);
kpeter@1406
   380
    checkLabel(g1,g2,l1,l2,iso);
kpeter@1406
   381
    return true;
kpeter@1406
   382
  }
kpeter@1406
   383
  return false;
kpeter@1406
   384
}
kpeter@1406
   385
kpeter@1406
   386
template<class G1,class G2>
kpeter@1406
   387
void checkSub(const G1 &g1, const G2 &g2, bool expected, const char* msg) {
kpeter@1406
   388
  check(checkSub(g1,g2,vf2(g1,g2)) == expected, msg);
kpeter@1406
   389
  check(checkSub(g1,g2,vf2pp(g1,g2)) == expected, msg);
kpeter@1406
   390
}
kpeter@1406
   391
kpeter@1406
   392
template<class G1,class G2>
kpeter@1406
   393
void checkInd(const G1 &g1, const G2 &g2, bool expected, const char* msg) {
kpeter@1406
   394
  check(checkInd(g1,g2,vf2(g1,g2)) == expected, msg);
kpeter@1406
   395
  check(checkInd(g1,g2,vf2pp(g1,g2)) == expected, msg);
kpeter@1406
   396
}
kpeter@1406
   397
kpeter@1406
   398
template<class G1,class G2>
kpeter@1406
   399
void checkIso(const G1 &g1, const G2 &g2, bool expected, const char* msg) {
kpeter@1406
   400
  check(checkIso(g1,g2,vf2(g1,g2)) == expected, msg);
kpeter@1406
   401
  check(checkIso(g1,g2,vf2pp(g1,g2)) == expected, msg);
madarasip@1350
   402
}
madarasip@1350
   403
madarasip@1350
   404
template<class G1,class G2,class L1,class L2>
kpeter@1406
   405
void checkSub(const G1 &g1, const G2 &g2, const L1 &l1, const L2 &l2, bool expected, const char* msg) {
kpeter@1406
   406
  check(checkSub(g1,g2,l1,l2,vf2(g1,g2)) == expected, msg);
kpeter@1406
   407
  check(checkSub(g1,g2,l1,l2,vf2pp(g1,g2)) == expected, msg);
madarasip@1350
   408
}
madarasip@1350
   409
madarasip@1350
   410
int main() {
madarasip@1350
   411
  make_graphs();
madarasip@1350
   412
kpeter@1406
   413
  checkSub(c5,petersen,true,
kpeter@1406
   414
      "There should exist a C5->Petersen mapping.");
kpeter@1406
   415
  checkSub(c7,petersen,false,
kpeter@1406
   416
      "There should not exist a C7->Petersen mapping.");
kpeter@1406
   417
  checkSub(p10,petersen,true,
kpeter@1406
   418
      "There should exist a P10->Petersen mapping.");
kpeter@1406
   419
  checkSub(c10,petersen,false,
kpeter@1406
   420
      "There should not exist a C10->Petersen mapping.");
kpeter@1406
   421
  checkSub(petersen,petersen,true,
kpeter@1406
   422
      "There should exist a Petersen->Petersen mapping.");
kpeter@1406
   423
kpeter@1406
   424
  checkInd(c5,petersen,true,
kpeter@1406
   425
      "There should exist a C5->Petersen spanned mapping.");
kpeter@1406
   426
  checkInd(c7,petersen,false,
kpeter@1406
   427
      "There should exist a C7->Petersen spanned mapping.");
kpeter@1406
   428
  checkInd(p10,petersen,false,
kpeter@1406
   429
      "There should not exist a P10->Petersen spanned mapping.");
kpeter@1406
   430
  checkInd(c10,petersen,false,
kpeter@1406
   431
      "There should not exist a C10->Petersen spanned mapping.");
kpeter@1406
   432
  checkInd(petersen,petersen,true,
madarasip@1350
   433
        "There should exist a Petersen->Petersen spanned mapping.");
madarasip@1350
   434
kpeter@1406
   435
  checkSub(petersen,c10,false,
kpeter@1406
   436
      "There should not exist a Petersen->C10 mapping.");
kpeter@1406
   437
  checkSub(p10,c10,true,
kpeter@1406
   438
      "There should exist a P10->C10 mapping.");
kpeter@1406
   439
  checkInd(p10,c10,false,
kpeter@1406
   440
      "There should not exist a P10->C10 spanned mapping.");
kpeter@1406
   441
  checkSub(c10,p10,false,
kpeter@1406
   442
      "There should not exist a C10->P10 mapping.");
madarasip@1350
   443
kpeter@1406
   444
  checkIso(p10,c10,false,
kpeter@1406
   445
      "P10 and C10 are not isomorphic.");
kpeter@1406
   446
  checkIso(c10,c10,true,
kpeter@1406
   447
      "C10 and C10 are isomorphic.");
alpar@1352
   448
kpeter@1406
   449
  checkSub(c5,petersen,c5_col,petersen_col1,false,
kpeter@1406
   450
      "There should exist a C5->Petersen mapping.");
kpeter@1406
   451
  checkSub(c5,petersen,c5_col,petersen_col2,true,
kpeter@1406
   452
      "There should exist a C5->Petersen mapping.");
madarasip@1350
   453
kpeter@1406
   454
  check(!vf2(p10,c10).iso().run(), "P10 and C10 are not isomorphic.");
kpeter@1406
   455
  check(!vf2pp(p10,c10).iso().run(), "P10 and C10 are not isomorphic.");
kpeter@1406
   456
kpeter@1406
   457
  check(vf2(c10,c10).iso().run(), "C10 and C10 are isomorphic.");
kpeter@1406
   458
  check(vf2pp(c10,c10).iso().run(), "C10 and C10 are isomorphic.");
madarasip@1350
   459
}