| Description of embed |
embed
PURPOSE 
embed --- create an embedding for a graph
SYNOPSIS 
function embed(g,xy)
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
- nv nv(g) --- number of vertices in g
- size size(g) --- returns [nv,ne] for the graph
This function is called by:
- bfstree bfstree(t,g,v) --- create a breadth-first spanning tree of g
- bucky bucky(g) --- overwrite g with the Buckyball graph (and give a nice
- cartesian cartesian(g,h1,h2) --- overwrite g with the product of h1 and h2
- cdraw cdraw(g,coloring) -- draw g with a given vertex coloring
- cube cube(g,k) --- create a k-cube (default k = 3)
- cycle cycle(g,n) --- create a cycle graph on n vertices
- dfstree dfstree(t,g,v) --- create a depth-first spanning tree of g
- disjoint_union disjoint_union(g,h,k) --- overwrite g with the disjoint union of the
- distxy distxy(g) -- give g a distance based embedding
- dodecahedron dodecahedron(g) --- overwrite g with the dodecahedron graph
- draw draw(g) --- draw g in a figure window
- graffle graffle(g, filename, width, rad) --- write graph in OmniGraffle format
- grid grid(g,a,b) --- create an a-by-b grid graph
- icosahedron icosahedron(g) --- overwrite g with the icosahedron graph
- induce induce --- create induced subgraphs
- join join(g,h1,h2) --- overwrite g with the join of h1 and h2
- line_graph line_graph(g,h) --- set g to be the line graph of h
- load load(g,filename) --- read a saved graph on disk
- mdsxy mdsxy(g) -- create an embedding based on multidimensional scaling
- mobius mobius(g,nverts) --- create a Mobius ladder graph
- octahedron octahedron(g) --- overwrite g with the octahedron graph, K(2,2,2)
- path path(g,n) --- make g a path on n vertices
- petersen petersen(g) --- overwrite g with the Petersen graph
- random_bipartite random_bipartite(g,n,m,p) --- create a random bipartite graph
- random_planar random_planar(g,n) --- create a random planar triangulation
- randxy randxy(g) --- give g a random embedding in the plane
- renumber renumber the vertices of a graph
- scale scale(g,s) --- rescale the embedding of g by s
- sgf sgf --- simple graph format: a 2-column matrix representation
- springxy springxy(g) --- find a spring embedding of g
SOURCE CODE 
0001 function embed(g,xy)
0002
0003
0004
0005
0006 global GRAPH_MAGIC;
0007
0008 n = nv(g);
0009
0010 if (nargin == 1)
0011 t = [0:n-1]*2*pi/n;
0012 x = n * cos(t)/6;
0013 y = n * sin(t)/6;
0014 xy = [x',y'];
0015 end
0016
0017 [nr,nc] = size(xy);
0018 if (nr ~= n) | (nc ~= 2)
0019 error('Embedding must be an n-by-2 matrix');
0020 end
0021
0022 GRAPH_MAGIC.graphs{g.idx}.xy = xy;
Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003
|
|