Dynamics of racial segregation and gentrification in New York City