UpdateGraph

                Never    
function cmcsGraph = UpdateGraph(cmcsGraph,cmcs,clusterChanged,radius)

global counterG callingTimesG timeTableG

% Compute distance to all other cmc
counterG = counterG+1;
tic ;
distanceVector = pdist2(cmcs.Centre(clusterChanged,:),cmcs.Centre); % distances between modified microC and all others
timeTableG(counterG) = toc ;
callingTimesG(counterG) = size(cmcs.Centre,1);

% List of microC that are edges
ind = find(distanceVector<1.5*radius);

% Remove self reference
ind(ind == clusterChanged) = [];
if ~isempty(ind)
    edges = sort([ones(length(ind),1)*clusterChanged ind'],2);
    edges = setdiff(edges,cmcsGraph.Edges.EndNodes,'rows');
    % Add missing edges
    if any(edges)
        cmcsGraph = addedge(cmcsGraph,edges(:,1),edges(:,2));
    end
end

% % Remove edges which their wieght become bigger than 1.5*R
% edges = cmcsGraph.Edges.EndNodes;
% ind = find(edges(:,1)==clusterChanged | edges(:,2)==clusterChanged);
% weights = zeros(1,size(ind,1));
% for k = 1:size(ind,1)
%     weights(k) = pdist2(cmcs.Centre(edges(ind(k),1),:),cmcs.Centre(edges(ind(k),2),:));
% end
% cmcsGraph = cmcsGraph.rmedge(ind(weights>1.5*radius));

end

Raw Text