Incorrect degrees of separation in Relative Distance instructions

Originally raised at There is inconsistency in relative-distance instructions · exercism/problem-specifications · Discussion #2561 · GitHub

In the instructions for Relative Distance, the text says the degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma). However, this should be Tariq -> Isla -> Uma for two degrees of separation. Tariq and Isla are both siblings so there’s no need to travel up to Helena and back down.

3 Likes

I’m a bit confused about the definition of “degree of separation” in the instructions. It says:

The degree of separation is defined as the shortest number of connections from one person to another.

A parent and child being 1 degree apart makes sense since they’re directly connected. But siblings aren’t directly connected in the diagram, they each connect to the parent. So to get from one sibling to another, I’d have to go: sibling → parent → sibling. That’s two connections, which would be 2 degrees of separation.

So why are siblings considered to have a degree of 1? It seems that I am misunderstanding how the degrees are being counted.

I believe the idea modeled by the exercise is one of degree of kinship. And, if that’s so, @tasx is right and siblings are two degrees apart from each other.

More information here:

Hey there,

Sorry for the confusion, I might have messed up the description. The exercise is very new.
I created this exercise to train trees and graph parsing. It is not meant to be a standard genetic information database.

This is not a remodelling of a real-world algorithm, so please don’t take external references. The tests should be the ultimate truth, the description should follow.

@BNAndras is correct in his interpretation of the exercise.

1 Like

Degrees of separation aren’t genealogical but based solely on proximity. Direct family (siblings, parents, and children commonly) have a single degree because they are the closest and then you branch out to their direct families as the second degree and so on. The visualization can be confusing because it shows genealogical distance instead of proximity. They’re not one and the same because from the tree’s perspective, I can go up, down, left, and right for a single degree of separation. A family tree would go up and down so backtracking is required to connect siblings

1 Like

Should we add a link between siblings, to improve the graph?

A dashed line could work. This might not work nicely with Markdown, but a second visualization can be also used in conjunction with the first one. We model Tariq in the middle and then fan it to their immediate family as the next ring. Then in another ring we fan out to each of their immediate family. At this point, we can highlight the shortest path through the rings.

I can’t follow. Can you illustrate that?


Each branch splits for that individual’s immediate family to show the paths we could take. That hopefully makes the sibling rule clearer.

1 Like

Perhaps the link in the instructions about the six degrees of separation should be removed? I’m not sure how it’s relevant to the exercise.

It helps explains the Easter egg I originally nudged vaeng to add. At least among my peers, Six Degrees of Kevin Bacon is a common piece of cultural knowledge, and it helped inspire similar recent trends like seeing how many Wikipedia pages does it take to get from one article to another. Therefore, the link provides some useful context. Anecdotally, some of my family members didn’t understand the exercise until I specifically brought up Kevin Bacon.

I see, but right now it’s just a link with the text “Kevin” and no explanation. Someone reading the example will click it and end up on a page about the six degrees of separation, which feels completely unrelated and unexpected. If the purpose of the link is to provide context, then that needs to be made clear separately.

1 Like

That’s fair. We could tweak that as well. Any initial thoughts?

“This is similar to the pop culture idea that everyone is <within six degrees of Kevin Bacon>.”

2 Likes

The improved graph may look like this:

      ┌──────────┐            ┌──────────┐     ┌───────────┐
      │  Helena  │            │  Erdős   │ ◀─▶ │  Shusaku  │
      └───┬───┬──┘            └─────┬────┘     └────┬──────┘
      ┌───┘   └───────┐             └───────┬───────┘
      ▼               ▼                     ▼
┌──────────┐     ┌────────┐           ┌──────────┐
│   Isla   │ ◀─▶ │  Tariq │           │   Kevin  │
└────┬─────┘     └────┬───┘           └──────────┘
     ▼                ▼
┌─────────┐      ┌────────┐
│   Uma   │      │ Morphy │
└─────────┘      └────────┘
2 Likes

It seems all the connections should be double-headed arrows. Isla to Tariq being called out as going either way implies that the other connections are one-way. I can go Helena → Isla → Uma, but I can also go Uma → Isla → Helena.

Or no arrows at all ? Just a line should be sufficient i think.

Since we’re visualizing part of a family tree, I’m concerned that an regular line might misrepresent the Isla and Tariq connection as a family tree branch. We’re only modeling distance along parents, children, and siblings, not spouses and their families.

Having double-headed arrows stretches the graph vertically (due to the UNICODE art style):

      ┌──────────┐            ┌──────────┐     ┌───────────┐
      │  Helena  │            │  Erdős   │ ◀─▶ │  Shusaku  │
      └──────────┘            └──────────┘     └───────────┘
          ▲   ▲                     ▲               ▲
      ┌───┘   └───────┐             └───────┬───────┘
      ▼               ▼                     ▼
┌──────────┐     ┌────────┐           ┌──────────┐
│   Isla   │ ◀─▶ │ Tariq  │           │   Kevin  │
└──────────┘     └────────┘           └──────────┘
     ▲                ▲
     │                │
     ▼                ▼
┌─────────┐      ┌────────┐
│   Uma   │      │ Morphy │
└─────────┘      └────────┘

Would it make sense to render the links without any arrows? The tree clearly branches downwards from parents to children so we don’t need single arrows there. Since we can’t use double arrows consistently, we shouldn’t use them at all so I’d render each link as a line including between siblings.

If that doesn’t make sense, let’s just go back to the double arrows between the siblings and single arrows between parents and children