Code covered by the BSD License
dodecahedron(g) --- overwrite g with the dodecahedron graph
0001 function dodecahedron(g) 0002 % dodecahedron(g) --- overwrite g with the dodecahedron graph 0003 0004 resize(g,20) 0005 clear_edges(g) 0006 full(g) 0007 0008 elist = [ 0009 1 2 0010 1 5 0011 1 6 0012 2 3 0013 2 7 0014 3 4 0015 3 8 0016 4 5 0017 4 9 0018 5 10 0019 6 11 0020 6 15 0021 7 11 0022 7 12 0023 8 12 0024 8 13 0025 9 13 0026 9 14 0027 10 14 0028 10 15 0029 11 16 0030 12 17 0031 13 18 0032 14 19 0033 15 20 0034 16 17 0035 16 20 0036 17 18 0037 18 19 0038 19 20 0039 ]; 0040 0041 add(g,elist); 0042 0043 t0 = 0; 0044 t1 = -2*pi/5; 0045 t2 = 2*t1; 0046 t3 = 3*t1; 0047 t4 = 4*t1; 0048 0049 ring1 = [ 0050 sin(t0) cos(t0) 0051 sin(t1) cos(t1) 0052 sin(t2) cos(t2) 0053 sin(t3) cos(t3) 0054 sin(t4) cos(t4) 0055 ]; 0056 0057 ring2 = ring1 * [cos(t1/2),-sin(t1/2);sin(t1/2),cos(t1/2)]; 0058 0059 xy = [ 0060 4*ring1; 0061 3*ring1; 0062 2*ring2; 0063 ring2 0064 ]; 0065 0066 embed(g,xy)
Contact us at files@mathworks.com