% approximate the diameter of a complementary
% component of a random walk trace by finding
% the smallest axis-parallel box containing the
% boundary of the component and taking the larger
% of the two side lengths

function diam=find_comp_diam(comp,dir_edges,verts)
K=length(comp);
for k=1:K
x(k) = verts(dir_edges(comp(k),1),1);
y(k) = verts(dir_edges(comp(k),1),2);
end % for k
delta_x=max(x)-min(x);
delta_y=max(y)-min(y);
diam= max(delta_x,delta_y);
return