    function idx = getClosestCtrs(X, ctrs)
 %% function idx = getClosestCtrs(X, ctrs)
   %% get closets center to every node       
   nC = size(ctrs, 1);
   idx = zeros(size(X,1), 1);
   m = size(X,1);

  for i=1:m
    k = 1;
    min_dist = sum((X(i,:) - ctrs(1,:)) .^ 2);
    for j=2:nC
        dist = sum((X(i,:) - ctrs(j,:)) .^ 2);
        if(dist < min_dist)
          min_dist = dist;
          k = j;
        end
    end
    idx(i) = k;
  end
end