Phase unwrapping is so important in interierometry that it determines the veraclty of the absolute phase value. Goldsteins branch-cut algorithm performs path-independent algorithm that uses a nearest neighbor heuristic to link and balance the residues based on identifying the residues. A modified nearest neighbor algorithm is presented based on the principle, the mathematic formula of the Goldsteins algorithm and indepth analysis of the key problem of phase unwrapping. It not only holds the advantage of the Goldsteins algorithm but also solves the problem that the Goldsteins algorithm is incapable to be used at high residue densities. Therefore, it extends the application of the Goldsteins algorithm and enhances the precision of phase unwrapping. Supported by Spaceflight Support Technology Fund Project (04 1. 3 JW05)