Code covered by the BSD License  

Highlights from
Matgraph

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

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

hasxy

PURPOSE ^

hasxy(g) --- determine if an embedding has been created for g

SYNOPSIS ^

function yn = hasxy(g)

DESCRIPTION ^

 hasxy(g) --- determine if an embedding has been created for g

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
  • 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
  • delete delete --- delete vertices or edges from a graph
  • 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
  • draw draw(g) --- draw g in a figure window
  • getxy getxy(g) --- give g's embedding (or [] if g doesn't have one)
  • graffle graffle(g, filename, width, rad) --- write graph in OmniGraffle format
  • 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
  • path path(g,n) --- make g a path on n vertices
  • renumber renumber the vertices of a graph
  • resize resize(g,n) --- change the number of vertices in g to n
  • rmxy rmxy(g) --- erase g's embedding
  • save save(g,filename) --- save a graph to disk
  • 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 yn = hasxy(g)
0002 % hasxy(g) --- determine if an embedding has been created for g
0003 
0004 global GRAPH_MAGIC;
0005 
0006 n = nv(g);
0007 
0008 if isfield(GRAPH_MAGIC.graphs{g.idx},'xy')
0009     % the field exsts. now is is the right size?
0010     [nr,nc] = size(GRAPH_MAGIC.graphs{g.idx}.xy);
0011     if (nr == n) & (nc == 2)
0012         yn = 1;
0013         return
0014     else
0015         yn = 0;
0016         GRAPH_MAGIC.graphs{g.idx} = ...
0017             rmfield(GRAPH_MAGIC.graphs{g.idx},'xy');
0018         return
0019     end
0020 end
0021 yn = 0;

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

Contact us at files@mathworks.com