getCallPaths | R Documentation |
Given a call graph of direct calls, this function computes all possible complete call paths/sequences to this function from top-level entry points to the target function. It does this by recursively traversing from what functions called the target, and what functions called those functions, ...
getCallPaths(fun, callGraph, recursive = TRUE, cur = "", depth = 1, asString = FALSE,
map = NULL,
recordTypes = if(!is.null(map))
map$name[map$type == "recordType"]
else character())
fun |
the name of the target function |
callGraph |
a data.frame of the direct calls in all of the code identifying which function directly calls which other function(s). |
recursive |
a logical value |
cur |
a character string, used for communicating state between recursive calls and not specified by the caller. |
depth |
an integer value giving the depth of the recursion of this function, with 1 being the initial top-level call. |
asString |
a scalar logical value controlling whether to return
each path as a single string of the form "A;B;C",
or a character vector of the form |
map |
an optional data.frame |
recordTypes |
an optional character vector of record type names |
A list.
Duncan Temple Lang
callGraph
#
# A -> B -> C -> fn
#
# X -> Y -> fn
gr0 = c("A", "B",
"B", "C",
"C", "fn",
"X", "Y",
"Y", "fn"
)
gr1 = as.data.frame(matrix(gr0, , 2, byrow = TRUE))
getCallPaths("fn", gr1)
#
# Add D -> C to give
# D
# \
# A -> B -> C -> fn
gr2 = c(gr0, "D", "C")
gr3 = as.data.frame(matrix(gr2, , 2, byrow = TRUE))
getCallPaths("fn", gr3)
# Now add
# H
# \
# G
# \
# F D
# \ \
# A -> B -> C -> fn
gr4 = c(gr2, "F", "B", "G", "F", "H", "G")
gr5 = as.data.frame(matrix(gr4, , 2, byrow = TRUE))
getCallPaths("fn", gr5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.