OKlibrary  0.2.1.6
Generators.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 24.6.2008 (Swansea) */
00002 /* Copyright 2008, 2009, 2010 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/Graphs/Lisp/Basic.mac")$
00024 oklib_include("OKlib/ComputerAlgebra/Graphs/Lisp/Generators.mac")$
00025 oklib_include("OKlib/ComputerAlgebra/Hypergraphs/Lisp/SetSystems.mac")$
00026 
00027 kill(f)$
00028 
00029 /* *******************
00030    * Complete graphs *
00031    *******************
00032 */
00033 
00034 okltest_complete_g(f) := (
00035   assert(f({}) = [{},{}]),
00036   assert(f({1}) = [{1},{}]),
00037   assert(f({3}) = [{3},{}]),
00038   assert(f({1,2}) = [{1,2},{{1,2}}]),
00039   for n : 0 thru 5 do block([G : f(setn(n))],
00040     assert(g_p(G)=true),
00041     assert(G[1] = setn(n)),
00042     assert(length(G[2]) = binomial(n,2))),
00043   assert(okltest_complete_stdg(buildq([f],lambda([n],f(setn(n)))))),
00044   true)$
00045 
00046 okltest_complete_stdg(f) := (
00047   assert(f(0) = [{},{}]),
00048   assert(f(1) = [{1},{}]),
00049   assert(f(2) = [{1,2},{{1,2}}]),
00050   assert(f(3) = [{1,2,3},{{1,2},{1,3},{2,3}}]),
00051   true)$
00052 
00053 
00054 /* ********************
00055    * Paths and cycles *
00056    ********************
00057 */
00058 
00059 okltest_pathgraph_og(f) := (
00060   assert(f(1) = [[1],[]]),
00061   assert(f(2) = [[1,2],[{1,2}]]),
00062   assert(f(3) = [[1,2,3],[{1,2},{2,3}]]),
00063   true)$
00064 
00065 okltest_cyclegraph_ogl(f) := (
00066   assert(f(1) = [[1],[{1}]]),
00067   assert(f(3) = [[1,2,3],[{1,2},{2,3},{3,1}]]),
00068   true)$
00069 
00070 okltest_cyclegraph_ogg(f) := (
00071   for n in cons(1,create_list(i,i,3,6)) do block([G : f(n)],
00072     assert(ogg_p(G) = true),
00073     assert(ogg2ogl(G) = cyclegraph_ogl(n))),
00074   assert(gr_equalp(f(2), [[1,2],[1,2],lambda([e],{1,2})]) = true),
00075   true)$
00076 
00077 
00078 /* **********
00079    * Dipols *
00080    **********
00081 */
00082 
00083 okltest_dipole_ogg(f) := (
00084   for n : 0 thru 3 do block([G : f(n)],
00085     assert(ogg_p(G) = true),
00086     assert(length(G[1]) = 2),
00087     assert(length(G[2]) = n),
00088     for e in G[2] do
00089       assert(G[3](e) = {1,2})
00090   ),
00091   true)$
00092 
00093 /* ************
00094    * Bouquets *
00095    ************
00096 */
00097 
00098 okltest_bouquet_ogg(f) := (
00099   for n : 0 thru 3 do block([G : f(n)],
00100     assert(ogg_p(G) = true),
00101     assert(length(G[1]) = 1),
00102     assert(length(G[2]) = n),
00103     for e in G[2] do
00104       assert(G[3](e) = {1})
00105   ),
00106   true)$
00107 
00108 
00109 /* *****************
00110    * Kneser graphs *
00111    *****************
00112 */
00113 
00114 okltest_kneser_g(f) := (
00115   assert(f(1,1) = [{{1}},{}]),
00116   assert(f(2,1) = [{{1},{2}},{{{1},{2}}}]),
00117   assert(f(2,2) = [{{1,2}},{}]),
00118   assert(f(3,1) = [{{1},{2},{3}}, {{{1},{2}},{{1},{3}},{{2},{3}}}]),
00119   assert(f(3,2) = [{{1,2},{1,3},{2,3}},{}]),
00120   assert(f(3,3) = [{{1,2,3}},{}]),
00121   assert(is_isomorphic(g2mg(f(5,2)), petersen_graph()) = true),
00122   true)$
00123 
00124