Game of Thrones Family Tree Analysis
Spoilers ahead. You have been warned.
Still with me? Ok, in working out the familial relationship between Daenerys Targaryen and Jon Snow we have to look back a few generations. The presence of incest in their shared lineage makes things more complicated than you might think. Here's a family tree:
The easiest answer to the relationship between Jon and Daenerys is that of Nephew and Aunt; Jon is the son of Daenerys' brother Rhaegar. This is already enough to prohibit a marriage between them under UK law, but by Westoros standards things are a little more lax (looking at you Cersei and Jaime). However, if you look higher up the tree you'll notice that Aerys (The Mad King) and his wife Rhaella were siblings. This decreases the total number of genes in the pool further.
Here's an interesting way of assessing the level of incest in a family. For someone with no incest the number of distinct ancestors within 1, 2, 3, 4... generations is 2, 2+4, 2+4+8, 2+4+8+16... which simplifies to 2, 6, 14, 30. For n generations we get a general formula:
For any particular person we can work out how many distinct ancestors they have and compare it with the number that a non incestuous family would have had. Let's work with a hypothetical child of Jon Snow and Daenerys Targaryen.
Generation 1: 2/2 Parents Jon and Daenerys
Generation 2: 6/6 As above, but with the four grandparents Aerys Targaryen, Rhaella Targaryen, Rhaegar Targaryen and Lyanna Stark. Things are good so far, but the fact that three quarters of the grandparents were all born with the same surname suggests things are not going to stay on track.
Generation 3: 10/14 As above, but with only four additional great grandparents rather than the expected 8. We have Lyanna Stark's parents contributing 2, but her husband's parents have already been counted into the mix as grandparents of the hypothetical child rather than the great grandparents, so this loses 2 distinct ancestors. We also lost 2 possible ancestors because Aerys and Rhaella shared their parents.
Generation 4: 18/30 At this point I had to go quite deep into ASoIaF wikis and some of the characters aren't named, but some of the family trees go back a good twenty generations. It is possibly as low as 16/30, because one set of parents was missing from my research and it is possible they were also the parents of Aegon Targaryen, but let's give them the benefit of the doubt.
As you go further and further back this ratio gets smaller and smaller (as it should for all of us). As soon as you hit incest at any point that continues to lower the ratio for all further generations going back.
I tried to do the same analysis on Gilly, but because she was a commoner there is no firm lineage data on her. Instead, let's look at the most incestuous family tree that I know of from real life. The Ptolemiac dynasty were a family of Greek descent who ruled Egypt for a while. To keep their blood lines nice and pure (i.e. not mixed with the locals that they thought of as essentially slaves) they mostly married their siblings. Most of the males were called Ptolemy and most of the females were called Cleopatra which makes work quite hard for historians.
Cleopatra VII (at the bottom) is THE Cleopatra so she seems like a good target for our analysis. She married four times, but only two of them to her brothers.
Generation 1: 2/2 Her parents.
Generation 2: 6/6 As above plus her grandparents. (Distinct names so far 3)
Generation 3: 9/14 Amazingly she only had 3 great grandparents that weren't already a closer relation to her.
Generation 4: 15/30
Generation 5: 23/62
So we can say with certainty that a potential child of Jon Snow and Daenerys is less incestouous than the most incestuous family I could think of (slightly).
For more on how family trees work (e.g. what is a second cousin once removed) see here.