getOrdPed: Orders a pedigree (parents before offspring) using Kahn's...

Description Usage Arguments Details Value References Examples

Description

Orders a pedigree (parents before offspring) using Kahn's Algorithm.

Usage

1
getOrdPed(pedigree, verbose = FALSE)

Arguments

pedigree

data.frame with three columns: id, sire and dam

Details

Kahn's algorithm is a topological sorting method commonly applied to networks. It's only feasible for acyclic directed graphs, so any cycles (ex. an individual that has itself as a parent) will return an error and must be corrected.

Value

Integer vector

References

Kahn, Arthur B. (1962), "Topological sorting of large networks", Communications of the ACM

Examples

1
2
3
4
5
6
id = c("A","B","C","D","E","F","G","H","I","J","K")
sire = c("0","0","0","0","A","A","C","A","G","G","A")
dam = c("0","0","0","0","B","H","D","D","B","E","H")
ped = as.data.frame(cbind(id,sire,dam))
newOrd = getOrdPed(ped)
pedReord = ped[ped$id[c(newOrd)],]

BrnCPrz/PedyR documentation built on May 6, 2019, 8:47 a.m.