Code covered by the BSD License  

Highlights from
Matgraph

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

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

ndraw

PURPOSE ^

ndraw(g) --- draw g in a figure window with numbered vertices

SYNOPSIS ^

function ndraw(g,line_style)

DESCRIPTION ^

 ndraw(g) --- draw g in a figure window with numbered vertices
 ndraw(g,line_style) --- lines have given line_style
 see also draw, ldraw, and cdraw

CROSS-REFERENCE INFORMATION ^

This function calls:
  • draw draw(g) --- draw g in a figure window
  • getxy getxy(g) --- give g's embedding (or [] if g doesn't have one)
  • nv nv(g) --- number of vertices in g
This function is called by:
  • ldraw ldraw(g,line_style) --- draw a graph with vertices marked with their labels

SOURCE CODE ^

0001 function ndraw(g,line_style)
0002 % ndraw(g) --- draw g in a figure window with numbered vertices
0003 % ndraw(g,line_style) --- lines have given line_style
0004 % see also draw, ldraw, and cdraw
0005 
0006 if nargin == 1
0007     draw(g);
0008 else
0009     draw(g,line_style);
0010 end
0011 
0012 xy = getxy(g);
0013 n = nv(g);
0014 
0015 for v=1:n
0016     x = xy(v,1);
0017     y = xy(v,2);
0018     text(x-.05,y,int2str(v)); 
0019 end

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

Contact us at files@mathworks.com