Learn R Programming

ggenealogy (version 1.0.3)

getPath: Determine the path between two varieties

Description

Determines the shortest path between the two inputted vertices, and takes into account whether or not the graph is directed. If there is a path, the list of vertices of the path will be returned. If there is not a path, a list of character(0) will be returned. Note: For a directed graph, the direction matters. However, this function will check both directions and return the path if it exists.

Usage

getPath(v1, v2, ig, geneal, colName, silent = FALSE, isDirected = FALSE)

Arguments

v1

the label of the first vertex of interest (in character string format)

v2

the label of the second vertex of interest (in character string format)

ig

the graph representation of the data genealogy (in igraph format)

geneal

the full genealogy (in data frame format)

colName

the name of the column of the data frame that contains the quantitative variable of interest (in character string format)

silent

whether or not to print output (defaults to false)

isDirected

whether or not the graph is directed (defaults to false)

References

Rutter L, VanderPlas S, Cook D, Graham MA (2019). ggenealogy: An R Package for Visualizing Genealogical Data. Journal of Statistical Software, 89(13), 1--31. tools:::Rd_expr_doi("10.18637/jss.v089.i13")

Examples

Run this code
data(sbGeneal)
ig <- dfToIG(sbGeneal)
getPath("Brim", "Bedford", ig, sbGeneal, "devYear")
getPath("Tokyo", "Volstate", ig, sbGeneal, "yield")

Run the code above in your browser using DataLab