Assignment problems are well-known problems in practice. We mention house markets, job markets, and production planning. The games of interest in this paper, the neighbor games, arise from a special class of assignment problems. We focus on the nucleolus [d. Schmeidler, siam j. Appl. Math. 17 (1969) 1163–1170], one of the most prominent core solutions. A core solution is interesting with respect to neighbor games because it divides the profit of an optimal matching in a stable manner. This paper establishes a polynomial bounded algorithm of quadratic order in the number of players for calculating the nucleolus of neighbor games.