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