Repository: exercism/problem-specifications
Pull request #2537: feat: add pathfinding exercise
Author: login: vaeng
Created: 2025-03-02T20:35:49Z | Merged: 2025-03-03T13:18:56Z

This is an idea I proposed on [Discord ](https://discord.com/channels/854117591135027261/1344967617391231020/1344970101618905148) as a reaction to @ErikSchierboom's call for exercises.


Diff:
diff --git a/exercises/relative-distance/canonical-data.json b/exercises/relative-distance/canonical-data.json
new file mode 100644
index 0000000000..5a7123c04a
--- /dev/null
+++ b/exercises/relative-distance/canonical-data.json
@@ -0,0 +1,255 @@
+{
+  "exercise": "relative-distance",
+  "cases": [
+    {
+      "uuid": "4a1ded74-5d32-47fb-8ae5-321f51d06b5b",
+      "description": "Direct parent-child relation",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Vera": ["Tomoko"],
+          "Tomoko": ["Aditi"]
+        },
+        "personA": "Vera",
+        "personB": "Tomoko"
+      },
+      "expected": 1
+    },
+    {
+      "uuid": "30d17269-83e9-4f82-a0d7-8ef9656d8dce",
+      "description": "Sibling relationship",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Dalia": ["Olga", "Yassin"]
+        },
+        "personA": "Olga",
+        "personB": "Yassin"
+      },
+      "expected": 1
+    },
+    {
+      "uuid": "8dffa27d-a8ab-496d-80b3-2f21c77648b5",
+      "description": "Two degrees of separation, grandchild",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Khadija": ["Mateo"],
+          "Mateo": ["Rami"]
+        },
+        "personA": "Khadija",
+        "personB": "Rami"
+      },
+      "expected": 2
+    },
+    {
+      "uuid": "34e56ec1-d528-4a42-908e-020a4606ee60",
+      "description": "Unrelated individuals",
+      "comments": [
+        "Some languages may return 0, -1 or similar to indicate no relation"
+      ],
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Priya": ["Rami"],
+          "Kaito": ["Elif"]
+        },
+        "personA": "Priya",
+        "personB": "Kaito"
+      },
+      "expected": null
+    },
+    {
+      "uuid": "93ffe989-bad2-48c4-878f-3acb1ce2611b",
+      "description": "Complex graph, cousins",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Aiko": ["Bao", "Carlos"],
+          "Bao": ["Dalia", "Elias"],
+          "Carlos": ["Fatima", "Gustavo"],
+          "Dalia": ["Hassan", "Isla"],
+          "Elias": ["Javier"],
+          "Fatima": ["Khadija", "Liam"],
+          "Gustavo": ["Mina"],
+          "Hassan": ["Noah", "Olga"],
+          "Isla": ["Pedro"],
+          "Javier": ["Quynh", "Ravi"],
+          "Khadija": ["Sofia"],
+          "Liam": ["Tariq", "Uma"],
+          "Mina": ["Viktor", "Wang"],
+          "Noah": ["Xiomara"],
+          "Olga": ["Yuki"],
+          "Pedro": ["Zane", "Aditi"],
+          "Quynh": ["Boris"],
+          "Ravi": ["Celine"],
+          "Sofia": ["Diego", "Elif"],
+          "Tariq": ["Farah"],
+          "Uma": ["Giorgio"],
+          "Viktor": ["Hana", "Ian"],
+          "Wang": ["Jing"],
+          "Xiomara": ["Kaito"],
+          "Yuki": ["Leila"],
+          "Zane": ["Mateo"],
+          "Aditi": ["Nia"],
+          "Boris": ["Oscar"],
+          "Celine": ["Priya"],
+          "Diego": ["Qi"],
+          "Elif": ["Rami"],
+          "Farah": ["Sven"],
+          "Giorgio": ["Tomoko"],
+          "Hana": ["Umar"],
+          "Ian": ["Vera"],
+          "Jing": ["Wyatt"],
+          "Kaito": ["Xia"],
+          "Leila": ["Yassin"],
+          "Mateo": ["Zara"],
+          "Nia": ["Antonio"],
+          "Oscar": ["Bianca"],
+          "Priya": ["Cai"],
+          "Qi": ["Dimitri"],
+          "Rami": ["Ewa"],
+          "Sven": ["Fabio"],
+          "Tomoko": ["Gabriela"],
+          "Umar": ["Helena"],
+          "Vera": ["Igor"],
+          "Wyatt": ["Jun"],
+          "Xia": ["Kim"],
+          "Yassin": ["Lucia"],
+          "Zara": ["Mohammed"]
+        },
+        "personA": "Dimitri",
+        "personB": "Fabio"
+      },
+      "expected": 4
+    },
+    {
+      "uuid": "2cc2e76b-013a-433c-9486-1dbe29bf06e5",
+      "description": "Complex graph, no shortcut, far removed nephew",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Aiko": ["Bao", "Carlos"],
+          "Bao": ["Dalia", "Elias"],
+          "Carlos": ["Fatima", "Gustavo"],
+          "Dalia": ["Hassan", "Isla"],
+          "Elias": ["Javier"],
+          "Fatima": ["Khadija", "Liam"],
+          "Gustavo": ["Mina"],
+          "Hassan": ["Noah", "Olga"],
+          "Isla": ["Pedro"],
+          "Javier": ["Quynh", "Ravi"],
+          "Khadija": ["Sofia"],
+          "Liam": ["Tariq", "Uma"],
+          "Mina": ["Viktor", "Wang"],
+          "Noah": ["Xiomara"],
+          "Olga": ["Yuki"],
+          "Pedro": ["Zane", "Aditi"],
+          "Quynh": ["Boris"],
+          "Ravi": ["Celine"],
+          "Sofia": ["Diego", "Elif"],
+          "Tariq": ["Farah"],
+          "Uma": ["Giorgio"],
+          "Viktor": ["Hana", "Ian"],
+          "Wang": ["Jing"],
+          "Xiomara": ["Kaito"],
+          "Yuki": ["Leila"],
+          "Zane": ["Mateo"],
+          "Aditi": ["Nia"],
+          "Boris": ["Oscar"],
+          "Celine": ["Priya"],
+          "Diego": ["Qi"],
+          "Elif": ["Rami"],
+          "Farah": ["Sven"],
+          "Giorgio": ["Tomoko"],
+          "Hana": ["Umar"],
+          "Ian": ["Vera"],
+          "Jing": ["Wyatt"],
+          "Kaito": ["Xia"],
+          "Leila": ["Yassin"],
+          "Mateo": ["Zara"],
+          "Nia": ["Antonio"],
+          "Oscar": ["Bianca"],
+          "Priya": ["Cai"],
+          "Qi": ["Dimitri"],
+          "Rami": ["Ewa"],
+          "Sven": ["Fabio"],
+          "Tomoko": ["Gabriela"],
+          "Umar": ["Helena"],
+          "Vera": ["Igor"],
+          "Wyatt": ["Jun"],
+          "Xia": ["Kim"],
+          "Yassin": ["Lucia"],
+          "Zara": ["Mohammed"]
+        },
+        "personA": "Lucia",
+        "personB": "Jun"
+      },
+      "expected": 15
+    },
+    {
+      "uuid": "46c9fbcb-e464-455f-a718-049ea3c7400a",
+      "description": "Complex graph, some shortcuts, cross-down and cross-up, cousins three times removed",
+      "property": "degreeOfSeparation",
+      "input": {
+        "familyTree": {
+          "Aiko": ["Bao", "Carlos"],
+          "Bao": ["Dalia", "Elias"],
+          "Carlos": ["Fatima", "Gustavo"],
+          "Dalia": ["Hassan", "Isla"],
+          "Elias": ["Javier"],
+          "Fatima": ["Khadija", "Liam"],
+          "Gustavo": ["Mina"],
+          "Hassan": ["Noah", "Olga"],
+          "Isla": ["Pedro"],
+          "Javier": ["Quynh", "Ravi"],
+          "Khadija": ["Viktor"],
+          "Liam": ["Tariq", "Uma"],
+          "Mina": ["Viktor", "Wang"],
+          "Noah": ["Xiomara"],
+          "Olga": ["Yuki"],
+          "Pedro": ["Zane", "Aditi"],
+          "Quynh": ["Boris"],
+          "Ravi": ["Celine"],
+          "Sofia": ["Diego", "Elif"],
+          "Tariq": ["Farah"],
+          "Uma": ["Giorgio"],
+          "Viktor": ["Hana", "Ian"],
+          "Wang": ["Jing"],
+          "Xiomara": ["Kaito"],
+          "Yuki": ["Leila"],
+          "Zane": ["Mateo"],
+          "Aditi": ["Nia"],
+          "Boris": ["Oscar"],
+          "Celine": ["Priya"],
+          "Diego": ["Qi"],
+          "Elif": ["Rami"],
+          "Farah": ["Sven"],
+          "Giorgio": ["Tomoko"],
+          "Hana": ["Umar"],
+          "Ian": ["Vera"],
+          "Jing": ["Wyatt"],
+          "Kaito": ["Xia"],
+          "Leila": ["Yassin"],
+          "Mateo": ["Zara"],
+          "Nia": ["Antonio"],
+          "Oscar": ["Bianca"],
+          "Priya": ["Cai"],
+          "Qi": ["Dimitri"],
+          "Rami": ["Ewa"],
+          "Sven": ["Fabio"],
+          "Tomoko": ["Gabriela"],
+          "Umar": ["Helena"],
+          "Vera": ["Igor"],
+          "Wyatt": ["Jun"],
+          "Xia": ["Kim"],
+          "Yassin": ["Lucia"],
+          "Zara": ["Mohammed"]
+        },
+        "personA": "Tomoko",
+        "personB": "Qi"
+      },
+      "expected": 8
+    }
+  ]
+}
diff --git a/exercises/relative-distance/instructions.md b/exercises/relative-distance/instructions.md
new file mode 100644
index 0000000000..9be1b2a905
--- /dev/null
+++ b/exercises/relative-distance/instructions.md
@@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or two parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no known relationship."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
+     ▼                ▼
+┌─────────┐      ┌────────┐
+│   Uma   │      │ Morphy │
+└─────────┘      └────────┘
+```
+
+The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
+There's no known relationship between Isla and [Kevin][six-bacons], as there is no connection in the given data.
+The degree of separation between Uma and Isla is 1.
+
+[six-bacons]: https://en.m.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon
diff --git a/exercises/relative-distance/introduction.md b/exercises/relative-distance/introduction.md
new file mode 100644
index 0000000000..cb9fee6c70
--- /dev/null
+++ b/exercises/relative-distance/introduction.md
@@ -0,0 +1,12 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Noble Knots is inspired by Iceland's "[Islendinga-App][islendiga-app]," which is backed up by a database that traces all known family connections between Icelanders from the time of the settlement of Iceland.
+Your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
+
+Will your app help crown a perfect match?
+
+[islendiga-app]: http://www.islendingaapp.is/information-in-english/
diff --git a/exercises/relative-distance/metadata.toml b/exercises/relative-distance/metadata.toml
new file mode 100644
index 0000000000..6f16602c4a
--- /dev/null
+++ b/exercises/relative-distance/metadata.toml
@@ -0,0 +1,4 @@
+title = "Relative Distance"
+blurb = "Given a family tree, calculate the degree of separation."
+source = "vaeng"
+source_url = "https://github.com/exercism/problem-specifications/pull/2537"


Reviews:
user: login: IsaacG
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-02T20:51:55Z
user: login: kotp
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-02T21:17:37Z
user: login: vaeng
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-02T21:21:26Z
user: login: BethanyG
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-02T21:30:52Z
user: login: tasxatzial
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-02T21:42:11Z
user: login: BNAndras
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-02T22:38:48Z
user: login: kotp
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T07:26:26Z
user: login: ErikSchierboom
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T07:39:18Z
user: login: ErikSchierboom
body: Lovely!
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T07:41:21Z
user: login: vaeng
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T08:53:56Z
user: login: vaeng
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T09:11:28Z
user: login: tasxatzial
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T10:20:12Z
user: login: vaeng
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T10:27:32Z
user: login: ErikSchierboom
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-03T12:41:50Z

Review comments:
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
path: exercises/relative-distance/instructions.md
user: login: kotp
body: Nice touch, that must be Kevin Bacon...
created_at: 2025-03-02T21:17:37Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
path: exercises/relative-distance/instructions.md
user: login: vaeng
body: It is. Thanks to @BNAndras for the trip down memory lane when we did this with other film nerds in my "sneak preview" circle.

created_at: 2025-03-02T21:21:26Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,11 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Inspired by Iceland’s famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
path: exercises/relative-distance/introduction.md
user: login: tasxatzial
body: ```suggestion
Inspired by Iceland's famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
```
created_at: 2025-03-02T21:37:05Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
+     ▼                ▼
+┌─────────┐      ┌────────┐
+│   Uma   │      │ Morphy │
+└─────────┘      └────────┘
+```
+
+The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
+The degree of separation between Isla and [Kevin][six-bacons] is not defined, as there is no visible relationship in the given data.
path: exercises/relative-distance/instructions.md
user: login: tasxatzial
body: If the "not defined" here is the same as "no relation" or "not connected" on line 8, then it might be better to standardize the terminology, for example
`
There's "no relation" between Isla and [Kevin][six-bacons], as there is no visible connection in the given data.
`
created_at: 2025-03-02T21:41:47Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Inspired by Iceland’s famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
path: exercises/relative-distance/introduction.md
user: login: BNAndras
body: The app itself isn’t famous nor is it even available any more. The database with the genealogical information should be the focus. I’d also remove the accidental dating part because that’s a thing  the app added. The database itself is a standard genealogical database so it doesn’t stop accidental dating any more than FamilySearch.
created_at: 2025-03-02T22:38:48Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
+     ▼                ▼
+┌─────────┐      ┌────────┐
+│   Uma   │      │ Morphy │
+└─────────┘      └────────┘
+```
+
+The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
+The degree of separation between Isla and [Kevin][six-bacons] is not defined, as there is no visible relationship in the given data.
path: exercises/relative-distance/instructions.md
user: login: kotp
body: "No known relationship" as it probably can not claim absolute knowledge.
created_at: 2025-03-03T07:26:26Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Inspired by Iceland’s famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
path: exercises/relative-distance/introduction.md
user: login: ErikSchierboom
body: I second this comment.
created_at: 2025-03-03T07:39:18Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
path: exercises/relative-distance/instructions.md
user: login: ErikSchierboom
body: Maybe:

```suggestion
- Each name is unique, a child _can_ have one or two parents.
```
created_at: 2025-03-03T07:40:45Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,11 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Inspired by Iceland’s famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
path: exercises/relative-distance/introduction.md
user: login: vaeng
body: Oh, I had no idea the app was discontinued. When it came out, it was quite the talk in my area, so I assumed it was well-known around the globe.

```suggestion
Noble Knots is inspired by Iceland's "[Islendinga-App][islendiga-app]," which is backed up by a database that traces all known family connections between Icelanders from the time of the settlement of Iceland.
Your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
```
created_at: 2025-03-03T08:53:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,11 @@
+# Introduction
+
+You've been hired to develop **Noble Knots**, the hottest new dating app for nobility!
+With centuries of royal intermarriage, things have gotten… _complicated_.
+To avoid any _oops-we're-twins_ situations, your job is to build a system that checks how closely two people are related.
+
+Inspired by Iceland’s famous "[Islendinga-App][islendiga-app]" (which prevents accidental dating of a close relative), your algorithm will determine the **degree of separation** between two individuals in the royal family tree.
path: exercises/relative-distance/introduction.md
user: login: vaeng
body: Thanks, I put that into the other suggestions, as they overlap.
created_at: 2025-03-03T09:11:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
+     ▼                ▼
+┌─────────┐      ┌────────┐
+│   Uma   │      │ Morphy │
+└─────────┘      └────────┘
+```
+
+The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
+The degree of separation between Isla and [Kevin][six-bacons] is not defined, as there is no visible relationship in the given data.
path: exercises/relative-distance/instructions.md
user: login: tasxatzial
body: @vaeng Could we then be consistent across the exercise and change "no relation" to "no known relationship"? (instructions and tests)
created_at: 2025-03-03T10:20:12Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,34 @@
+# Instructions
+
+Your task is to determine the degree of separation between two individuals in a family tree.
+
+- You will be given an input, with all parent names and their children.
+- Each name is unique, a child _can_ have one or more parents.
+- The degree of separation is defined as the shortest number of connections from one person to another.
+- If two individuals are not connected, return a value that represents "no relation."
+  Please see the test cases for the actual implementation.
+
+## Example
+
+Given the following family tree:
+
+```text
+      ┌──────────┐            ┌──────────┐ ┌───────────┐
+      │  Helena  │            │  Erdős   │ │  Shusaku  │
+      └───┬───┬──┘            └─────┬────┘ └──────┬────┘
+      ┌───┘   └───────┐             └──────┬──────┘
+      ▼               ▼                    ▼
+┌──────────┐     ┌────────┐          ┌──────────┐
+│   Isla   │     │  Tariq │          │   Kevin  │
+└────┬─────┘     └────┬───┘          └──────────┘
+     ▼                ▼
+┌─────────┐      ┌────────┐
+│   Uma   │      │ Morphy │
+└─────────┘      └────────┘
+```
+
+The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
+The degree of separation between Isla and [Kevin][six-bacons] is not defined, as there is no visible relationship in the given data.
path: exercises/relative-distance/instructions.md
user: login: vaeng
body: Good idea, I just pushed that.
created_at: 2025-03-03T10:27:32Z
author_association: CONTRIBUTOR

PR comments:
user: login: BNAndras
created_at: 2025-03-02T21:01:59Z
body: Degrees of separation make me think of https://en.m.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon. Maybe we could add a Kevin as a homage?
author_association: MEMBER
user: login: jiegillet
created_at: 2025-03-07T06:01:32Z
body: I've been trying to implement this one in Elixir, but I'm having trouble solving it, I think some cases may have issues.
1. "Direct parent-child relation" => degree 1, no problem
2. "Sibling relationship" => expected degree between siblings is 1, but from the description I expected it to be 2, with the path being: left child => parent => right child. Bypassing the parent for siblings is fine as a rule, but it should be explicit.
3. "Two degrees of separation, grandchild" => degree 2, no problem
4.  "Unrelated individuals" => no problem
5. "Complex graph, cousins" => degree 4, but my solution gave degree 9. I did it by hand and I also get 9 (with the rule of siblings having a degree of separation 1, otherwise you would get 10)
6. "Complex graph, no shortcut, far removed nephew" => degree 15, but my solution fives me 14 (it could be 15 without the siblings rule potentially, I did not do this one by hand)
7. "Complex graph, some shortcuts, cross-down and cross-up, cousins three times removed" => degree 8, but my solution gives me no connection, and I confirmed by hand. Sofia doesn't have a parent, and she starts a second family with Qi in it.

@vaeng could you help me here?

Also in general, I like having large inputs, but only at the end when all base case have been covered. The cousin case, for example could be much smaller, it took me a long time to verify by hand.
I also noticed that the Elixir exercise generator does not preserve the ordering of the family tree entries, but with random order I never would have been able to check my solutions by hand, so maybe it's worth adding a comment saying that preserving the order would be a good idea.

[Here is my tentative implementation](https://github.com/exercism/elixir/pull/1554).
author_association: CONTRIBUTOR