OKlibrary  0.2.1.6
IndependentSets.mac
Go to the documentation of this file.
```00001 /* Oliver Kullmann, 9.2.2008 (Swansea) */
00002 /* Copyright 2008, 2009 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")\$
00023 oklib_include("OKlib/ComputerAlgebra/Hypergraphs/Lisp/Transversals/Minimal/tests/RecursiveSplitting.mac")\$
00024 oklib_include("OKlib/ComputerAlgebra/Hypergraphs/Lisp/Basics.mac")\$
00025
00026 kill(f)\$
00027
00028
00029 okltest_independentset_p(f) := (
00030   assert(f({},{}) = true),
00031   assert(f({},{{}}) = false),
00032   assert(f({},{{1}}) = true),
00033   assert(f({1},{{2},{1,2}}) = true),
00034   assert(f({1},{{2},{1,2},{1}}) = false),
00035   true)\$
00036
00037
00038 /* *************************************************
00039    * The independency hypergraph (of a hypergraph) *
00040    *************************************************
00041 */
00042
00043 /* Testing whether f computes the independence hypergraph */
00044 okltest_independence_hyp(f) := block(
00045   assert(f([{},{}]) = [{},{{}}]),
00046   assert(f([{},{{}}]) = [{},{}]),
00047   assert(f([{1,2},{{1}}]) = [{1,2},{{2}}]),
00048   if oklib_test_level = 0 then return(true),
00049   block([oklib_test_level : min(oklib_test_level-1, 2)],
00050     okltest_transversal_hyp(buildq([f],lambda([G],ecomp_hyp(f(G)))))
00051   ),
00052 true)\$
00053
00054
```