Asymptotic analysis of random matrices with external source and a family of algebraic curves