Code covered by the BSD License  

Highlights from
Matgraph

from Matgraph by Ed Scheinerman
Toolbox for working with simple, undirected graphs

Description of octahedron
Home > matgraph > @graph > octahedron.m

octahedron

PURPOSE ^

octahedron(g) --- overwrite g with the octahedron graph, K(2,2,2)

SYNOPSIS ^

function octahedron(g)

DESCRIPTION ^

 octahedron(g) --- overwrite g with the octahedron graph, K(2,2,2)

CROSS-REFERENCE INFORMATION ^

This function calls:
  • add add --- add edge(s) to the graph
  • clear_edges clear_edges(g) --- delete all edges of g
  • embed embed --- create an embedding for a graph
  • full full(g) --- convert internal storage for g to full
  • resize resize(g,n) --- change the number of vertices in g to n
This function is called by:

SOURCE CODE ^

0001 function octahedron(g)
0002 % octahedron(g) --- overwrite g with the octahedron graph, K(2,2,2)
0003 
0004 
0005 resize(g,6);
0006 full(g);
0007 clear_edges(g);
0008 
0009 elist = [
0010     1   2
0011     1   3
0012     2   3
0013     4   5
0014     4   6
0015     5   6
0016     1   5  
0017     3   5
0018     1   6
0019     2   6
0020     2   4
0021     3   4
0022 ];
0023 
0024 add(g,elist);
0025 
0026 
0027 xy = [
0028     0               1/2
0029     -sqrt(3)/4       -1/4
0030     sqrt(3)/4      -1/4
0031     0               -8/3
0032     4/sqrt(3)       4/3
0033     -4/sqrt(3)      4/3
0034     ];
0035 
0036 embed(g,xy);

Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003

Contact us at files@mathworks.com