Home > matgraph > @graph > trim.m

trim

PURPOSE ^

trim(g,d) --- iteratively remove vertices of degree at most d

SYNOPSIS ^

function trim(g,d)

DESCRIPTION ^

 trim(g,d) --- iteratively remove vertices of degree at most d

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function trim(g,d)
0002 % trim(g,d) --- iteratively remove vertices of degree at most d
0003 
0004 if nargin==1
0005     d = 0;
0006 end
0007 
0008 ds = deg(g);
0009 x = find(ds <= d);
0010 x=x';
0011 while (length(x) > 0)
0012     if (nv(g) == 0)
0013         return
0014     end
0015     delete(g,x);
0016     ds = deg(g);
0017     x = find(ds <= d);
0018     x=x';
0019 end

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