There is a very detailed analysis in A State-By-State Examination of the Parental Rights of Fathers Who Conceive a Child by Rape
Really there is no substitute for going through each state's law individually, because the statutory language placing limitations on parental rights in cases of rape varies greatly.
The phrasing in the title question "Do 31 states give rapist fathers visitation rights" is too vague to precisely answer. The answer is totally different depending upon whether the question is construed as "do 31 states have no way to prevent a rapist father from having visitation?", versus, "do 31 have some possibility of allowing a rapist father to have visitation?".
Only a few states seem to absolutely bar the possibility of a rapist father having visitation:
California law is:
No person shall be granted custody of, or visitation with, a child if the person has been convicted under Section 261of the Penal Code [rape or unlawful intercourse] and the child was conceived as a result of that violation.
Louisiana
In a proceeding in which visitation of a child is being sought by a parent, if the child was conceived through the commission of a felony rape, the parent who committed the felony rape shall be denied visitation rights and contact with the child.
Other states are less absolute:
Idaho
The court may grant an order terminating the relationship and may rebuttably presume that such termination of parental rights is in the best interests of the child where: (a) The parent caused the child to be conceived as a result of rape, incest, lewd conduct with a minor child under the age of sixteen (16) years, or sexual abuse of a child under the age of sixteen (16) years
South Dakota
If it is in the best interest of the child, the court may prohibit, revoke, or restrict visitation rights to a child for any person who has caused the child to be conceived as a result of rape or incest.
Going through the table in the reference, 20 states have some degree of legislation concerning restricting the custody or visitation of a rapist father (not including laws solely concerning adoption). These are:
- California
Connecticut
Idaho
Iowa
Kansas
Louisiana
Maine
Michigan
Missouri
Montana
Nevada
New Jersey
North Carolina
Oklahoma
Oregon
Pennsylvania
South Dakota
Tennessee
Texas
Wisconsin
So 20 states have legislation that addresses custody and/or visitation rights (beyond adoption related legislation) in cases of rape; however, less than 20 absolutely prohibit a rapist father from having any possibility of visitation or custody.
Of the other 30 states, 18 have no specific law addressing parental rights of rapist fathers, and 12 have adoption-related legislation restricting the rights of rapist fathers.