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