Inference of genealogical structure