Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: relative distance #2545

Merged
merged 3 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions exercises/relative-distance/canonical-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"personA": "Dimitri",
"personB": "Fabio"
},
"expected": 4
"expected": 9
},
{
"uuid": "2cc2e76b-013a-433c-9486-1dbe29bf06e5",
Expand Down Expand Up @@ -185,25 +185,24 @@
"personA": "Lucia",
"personB": "Jun"
},
"expected": 15
"expected": 14
},
{
"uuid": "46c9fbcb-e464-455f-a718-049ea3c7400a",
"description": "Complex graph, some shortcuts, cross-down and cross-up, cousins three times removed",
"description": "Complex graph, some shortcuts, cross-down and cross-up, cousins several times removed, with unrelated family tree",
"property": "degreeOfSeparation",
"input": {
"familyTree": {
"Aiko": ["Bao", "Carlos"],
"Bao": ["Dalia", "Elias"],
"Bao": ["Dalia"],
"Carlos": ["Fatima", "Gustavo"],
"Dalia": ["Hassan", "Isla"],
"Elias": ["Javier"],
"Fatima": ["Khadija", "Liam"],
"Gustavo": ["Mina"],
"Hassan": ["Noah", "Olga"],
"Isla": ["Pedro"],
"Javier": ["Quynh", "Ravi"],
"Khadija": ["Viktor"],
"Khadija": ["Sofia"],
"Liam": ["Tariq", "Uma"],
"Mina": ["Viktor", "Wang"],
"Noah": ["Xiomara"],
Expand Down Expand Up @@ -246,10 +245,10 @@
"Yassin": ["Lucia"],
"Zara": ["Mohammed"]
},
"personA": "Tomoko",
"personB": "Qi"
"personA": "Wyatt",
"personB": "Xia"
},
"expected": 8
"expected": 12
}
]
}
5 changes: 5 additions & 0 deletions exercises/relative-distance/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla
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.

~~~~exercism/note
Isla and Tariq are siblings and have a separation of 1.
Similarly, this implementation would report a separation of 2 from you to your father's brother.
~~~~

[six-bacons]: https://en.m.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon
Loading