   function B = getMat(A, set, labl)
%% function B = getMat(A, set, labl)    
%%------------- builds a laplacian associated
%% with a subgraph . Set is the set of verticees
%% of the desired subgraph, and labl carries the labels of 
%% the nodes. Not that A is the original Laplacian, i.e., all
%% indices are with respect to the original A
%% on return B is the graph Laplacian of the subgraph.
%% 
 n = length(set);
 N = size(A,1);
 indxInv(set) = [1:n] ; 
 B = sparse(n,n);
%%------------ find the label of this domain 
 thisLabel = labl(set(1)) ;
 for i=1:n 
%%-------------------- get row of i-th node 
     node = set(i);     %% this is an absolute label.
     [J, I, vals] = find(A(:,node));
     Jout = [];
     valsout = [];
     len = 0;
     for k=1:length(J)
     jj = J(k);
     if (labl(jj)==thisLabel & jj~=node) 
             len = len+1;
             Jout(len)    = indxInv(jj);
%%           valsout(len) = vals(k); 
          valsout(len) = -1.0;
          end
     end
%%-------------------- 
      if (len > 0) 
         B(Jout,i) =  valsout;
      end
end
 d = B*ones(n,1) ;
%%--- non-normalized
 B = spdiags(-d, 0, B); 
