function [V,E,a] = imgeig(img, k, support)
% function [V,E,a] = imgeig(img, k, support)
%
% generate k eigenvectors,
% with image support = support
%
% written by Daniel A. Spielman, Sep 26, 2006.

if (nargin < 3)
  support = 1;
end

[a] = imgseg(img,support);

si2 = sparse(1./sqrt(sum(a)));
di2 = diag(si2);

l = speye(length(a))*(1+10^(-8)) - di2*a*di2;
f = amdSolveF(l);

[V,E] = eigs(f,length(a),k);

V = di2*V;
