You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
804 B
27 lines
804 B
6 years ago
|
function clusters = recursiveNCuts(graph)
|
||
|
%RECURSIVENCUTS Summary of this function goes here
|
||
|
% Detailed explanation goes here
|
||
|
|
||
|
clusters = myNCuts(graph, 2);
|
||
|
|
||
|
if (nnz(clusters == 1) < 5 || nnz(clusters == 2) < 5)
|
||
|
return;
|
||
|
end
|
||
|
|
||
|
NCut = calculateNcut(graph, clusters);
|
||
|
if (NCut > 0.85)
|
||
|
return;
|
||
|
end
|
||
|
|
||
|
clusterOneIndices = (clusters == 1);
|
||
|
clusterTwoIndices = (clusters == 2);
|
||
|
|
||
|
firstSubClusters = recursiveNCuts(graph(clusterOneIndices, clusterOneIndices'));
|
||
|
secondSubClusters = recursiveNCuts(graph(clusterTwoIndices, clusterTwoIndices'));
|
||
|
|
||
|
secondSubClusters = secondSubClusters + size(unique(firstSubClusters), 1);
|
||
|
|
||
|
clusters(clusterOneIndices) = firstSubClusters;
|
||
|
clusters(clusterTwoIndices) = secondSubClusters;
|
||
|
end
|