Solved the NaN issue in the sparse laplacian. Also added a minimum weight in the grid graph so the eigenvalues algorithm converges better. With the corrected laplacian, isoperimetric graph partitioning seems to actually work, right now it's oversegmenting quite a bit though.