function newgraph = cluster_compts_into_obj( obj )
if nargin == 1
    database = [];
end

 [~,idxcompts] = srec_cluster_compts_by_farthest_sampling(obj);
 
 % symmetric component must be included
 idxcompts_sym = obj.get_symmetric_idxcompts(idxcompts);
 idxcompts_sym = idxcompts_sym(idxcompts_sym~=0);
 idxcompts = cat(2,idxcompts(:)',idxcompts_sym(:)');
 idxcompts = unique(idxcompts);
 
 newgraph = obj.subgraph(idxcompts);

end

% function newgraph = cluster_compts_into_obj( obj,database )
% 
% % currently, only complete graph is considered
% % adjmat_comp2comp = true(size(obj.m_adjmat_comp2comp));
% adjmat_comp2comp = ~obj.m_adjmat_invalid_comp2comp;
% idxcompts_per_obj = srec_find_merge_subgraph(adjmat_comp2comp,obj,database);
% obj.m_idxcompts_per_obj = idxcompts_per_obj;
% 
% nobj = length(idxcompts_per_obj);
% idxcompts_new = zeros(1,nobj);
% 
% % collect samples and label
% complbs = obj.m_complabels;
% compscores = obj.m_compscores;
% 
% for i=1:nobj
%     idxcompts = idxcompts_per_obj{i};
%     
%     % clustered compts must have the same label
%     thislbs = complbs(idxcompts);
%     ulb = unique(thislbs);
%     assert(isscalar(ulb));
%     
%     % cluster center is taken as the max scored compts
%     [~,idxmax] = max(compscores(idxcompts));
%     idxcompts_new(i) = idxcompts(idxmax);
% end
% newgraph = obj.subgraph(idxcompts_new);
% 
% end














