part = split(g) --- partition the vertices of g into two subsets The graph is partitioned based on the eigenvector associated with the 2nd smallest eigenvalue of the Laplacian of g.
0001 function part = split(g) 0002 % part = split(g) --- partition the vertices of g into two subsets 0003 % The graph is partitioned based on the eigenvector associated with the 2nd 0004 % smallest eigenvalue of the Laplacian of g. 0005 0006 L = laplacian(g); 0007 0008 [V,d] = eig(L); 0009 v2 = V(:,2); 0010 0011 % if (sum(v2)<0) 0012 % v2 = -v2; 0013 % end 0014 0015 part = cell(1,2); 0016 0017 part{1} = find(v2 > 0); 0018 part{2} = find(v2 <= 0); 0019 part = partition(part);