mycielski(g,n) --- create n'th order Mycielski graph (n > 0)
SYNOPSIS
function mycielski(g,h)
DESCRIPTION
mycielski(g,n) --- create n'th order Mycielski graph (n > 0)
mycielski(g,h) --- apply Mycielski step to h to give g
e.g., mycielski(g,3) overwrites G with the Grotztsch graph
Thanks: Kim Tucker
CROSS-REFERENCE INFORMATION
This function calls:
complete complete: build complete and complete multipartite graphs
fast_set_matrix fast_set_matrix(g,A) --- overwrite the adjacency matrix of g with A
matrix matrix(g) --- return (a copy of) the adjacency matrix of g
0001 function mycielski(g,h)
0002 % mycielski(g,n) --- create n'th order Mycielski graph (n > 0)
0003 % mycielski(g,h) --- apply Mycielski step to h to give g
0004 % e.g., mycielski(g,3) overwrites G with the Grotztsch graph
0005 % Thanks: Kim Tucker
0006
0007
0008 % if 2nd argument is a graph, apply construction one time
0009
0010 if (isa(h,'graph'))
0011 B = matrix(h);
0012 n = length(B);
0013
0014 A = [ B, B, zeros(n,1);
0015 B, zeros(n), ones(n,1);
0016 zeros(1,n), ones(1,n), 0 ];
0017 fast_set_matrix(g,A);
0018 rmxy(g);
0019 return
0020 end
0021
0022
0023 % otherwise, 2nd argument is an integer
0024
0025 h = floor(h);
0026
0027 if (h<=0)
0028 complete(g,1);
0029 return
0030 end
0031
0032 if (h == 1)
0033 complete(g,2);
0034 return
0035 end
0036
0037 mycielski(g,h-1);
0038 mycielski(g,g);