Code covered by the BSD License  

Highlights from
Matgraph

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

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

wheel

PURPOSE ^

wheel(g,n) --- overwrite g with a wheel graph on n vertices

SYNOPSIS ^

function wheel(g,n)

DESCRIPTION ^

 wheel(g,n) --- overwrite g with a wheel graph on n vertices
 if n is omitted, we use the number of vertices in g

CROSS-REFERENCE INFORMATION ^

This function calls:
  • add add --- add edge(s) to the graph
  • cycle cycle(g,n) --- create a cycle graph on n vertices
  • nv nv(g) --- number of vertices in g
  • resize resize(g,n) --- change the number of vertices in g to n
This function is called by:

SOURCE CODE ^

0001 function wheel(g,n)
0002 % wheel(g,n) --- overwrite g with a wheel graph on n vertices
0003 % if n is omitted, we use the number of vertices in g
0004 
0005 if (nargin == 1)
0006     n = nv(g);
0007 end
0008 
0009 cycle(g,n-1);
0010 resize(g,n);
0011 for k=1:n-1
0012     add(g,k,n);
0013 end

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

Contact us at files@mathworks.com