function plotmcl(a,xy,m)
% function plotmcl(a,xy,m)
%
% a is the adjacency matrix, xy are the coords,
% m is the result of the mcl computation.
%
% only gives good pictures when the graph really
% divides into clusters.


%javaaddpath java
%import bfsShad.*;

n = length(a);

[mi,mj,mv] = find(m+m');
ind = find(mv > .001);
%pg = PreGraph(mi(ind),mj(ind),mv(ind));
%c = pg.components;
c = comps(sparse(mi(ind),mj(ind),mv(ind),n,n));
clf
hold on

[x,y] = gplot(a,xy);
plot(x,y,'-','Color',[.9 .9 .9])

for i = 0:max(c),
  ind = find(c==i);
  [x,y] = gplot(a(ind,ind),xy(ind,:));
  r = rand(3,1); 
  r = r / max(r);
  while (sum(r) > 2.5), r = r.^(1.5); end
  
  plot(x,y,'-','Color',r);
end

ac = find(diag(m) > .1);
hold on; plot(xy(ac,1),xy(ac,2),'ro','MarkerFaceColor','r');
