The data is recursive: persons link to families and families link to persons. So you might start with a person, then call person.getParentFamilies(gedcom) to get a list of Family objects, then for each Family object you could call family.getHusbands(gedcom) to get a list of (probably 0 or 1) husband person objects, and family.getWives(gedcom) to get a list of (probably 0 or 1) wife person objects, and then recursively call your function on each of the husband and wife people to get their parents.