Skip to content

Instantly share code, notes, and snippets.

View rasmushaglund's full-sized avatar

Rasmus Haglund rasmushaglund

View GitHub Profile
@rasmushaglund
rasmushaglund / coefficientOfRelationship.js
Last active March 8, 2020 00:56
Calculate coefficient of relationship in javascript
// Used to calculate Coefficient of relationship
// https://en.wikipedia.org/wiki/Coefficient_of_relationship
// Limitations: Does not handle identical twin common ancestors
// Test examples based on http://www.genetic-genealogy.co.uk/Toc115570135.html
var init = function (persons) {
for (p in persons) {
persons[p].children = [];