Recent work of the authors and their collaborators has uncovered fundamental connections between the Dirichlet-to-Neumann map, the spectral flow of a certain family of self-adjoint operators, and the nodal deficiency of a Laplacian eigenfunction (or an analogous deficiency associated to a non-bipartite equipartition). Using a more refined construction of the Dirichlet-to-Neumann map, we strengthen all of these results, in particular getting improved bounds on the nodal deficiency of degenerate eigenfunctions. Our framework is very general, allowing for non-bipartite partitions, non-simple eigenvalues, and non-smooth nodal sets. Consequently, our results can be used in the general study of spectral minimal partitions, not just nodal partitions of generic Laplacian eigenfunctions.