Skip to content

Commit 9f04b3e

Browse files
committed
Rename father parameter/field to parent in BFS/DFS calls
1 parent 9a3385f commit 9f04b3e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

R/map.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,13 @@ map_local_dbl <- function(order = 1, mode = 'all', mindist = 0, .f, ...) {
421421
#' @importFrom tibble tibble
422422
bfs_df <- function(graph, root, mode, unreachable) {
423423
search <- bfs(graph = graph, root = root, mode = mode, unreachable = unreachable,
424-
order = TRUE, rank = TRUE, father = TRUE, pred = TRUE,
424+
order = TRUE, rank = TRUE, parent = TRUE, pred = TRUE,
425425
succ = TRUE, dist = TRUE)
426426
nodes <- seq_along(search$order)
427427
tibble(
428428
node = nodes,
429429
rank = as.integer(search$rank),
430-
parent = as.integer(search$father),
430+
parent = as.integer(search$parent),
431431
before = as.integer(search$pred),
432432
after = as.integer(search$succ),
433433
dist = as.integer(search$dist),
@@ -438,13 +438,13 @@ bfs_df <- function(graph, root, mode, unreachable) {
438438
#' @importFrom tibble tibble
439439
dfs_df <- function(graph, root, mode, unreachable) {
440440
search <- dfs(graph = graph, root = root, mode = mode, unreachable = unreachable,
441-
order = TRUE, order.out = TRUE, father = TRUE, dist = TRUE)
441+
order = TRUE, order.out = TRUE, parent = TRUE, dist = TRUE)
442442
nodes <- seq_along(search$order)
443443
tibble(
444444
node = nodes,
445445
rank = match(nodes, as.integer(search$order)),
446446
rank_out = match(nodes, as.integer(search$order.out)),
447-
parent = as.integer(search$father),
447+
parent = as.integer(search$parent),
448448
dist = as.integer(search$dist),
449449
result = rep(list(NULL), length(nodes))
450450
)

R/morphers.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ to_shortest_path <- function(graph, from, to, mode = 'out', weights = NULL) {
217217
to_bfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) {
218218
root <- eval_tidy(enquo(root), as_tibble(graph, 'nodes'))
219219
root <- as_node_ind(root, graph)
220-
search <- bfs(graph, root, mode = mode, unreachable = unreachable, father = TRUE)
220+
search <- bfs(graph, root, mode = mode, unreachable = unreachable, parent = TRUE)
221221
bfs_graph <- search_to_graph(graph, search)
222222
list(
223223
bfs = bfs_graph
@@ -230,7 +230,7 @@ to_bfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) {
230230
to_dfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) {
231231
root <- eval_tidy(enquo(root), as_tibble(graph, 'nodes'))
232232
root <- as_node_ind(root, graph)
233-
search <- dfs(graph, root, mode = mode, unreachable = unreachable, father = TRUE)
233+
search <- dfs(graph, root, mode = mode, unreachable = unreachable, parent = TRUE)
234234
dfs_graph <- search_to_graph(graph, search)
235235
list(
236236
dfs = dfs_graph
@@ -340,7 +340,7 @@ to_hierarchical_clusters <- function(graph, method = 'walktrap', weights = NULL,
340340

341341
search_to_graph <- function(graph, search) {
342342
nodes <- as_tibble(graph, active = 'nodes')
343-
edges <- tibble(from = search$father, to = seq_len(nrow(nodes)))
343+
edges <- tibble(from = search$parent, to = seq_len(nrow(nodes)))
344344
edges <- edges[!is.na(edges$from), , drop = FALSE]
345345
tbl_graph(nodes, edges)
346346
}

R/search.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bfs_parent <- function(root, mode = 'out', unreachable = FALSE) {
5656
graph <- .G()
5757
root <- as_node_ind(root, graph)
5858
ind <- bfs(graph = graph, root = root, mode = mode, unreachable = unreachable,
59-
order = TRUE, father = TRUE)$father
59+
order = TRUE, parent = TRUE)$parent
6060
as.integer(ind)[focus_ind(graph, 'nodes')]
6161
}
6262
#' @describeIn search_graph Get the node that was visited before each node in a breath first search
@@ -125,7 +125,7 @@ dfs_parent <- function(root, mode = 'out', unreachable = FALSE) {
125125
graph <- .G()
126126
root <- as_node_ind(root, graph)
127127
ind <- dfs(graph = graph, root = root, mode = mode, unreachable = unreachable,
128-
order = TRUE, father = TRUE)$father
128+
order = TRUE, parent = TRUE)$parent
129129
as.integer(ind)[focus_ind(graph, 'nodes')]
130130
}
131131
#' @describeIn search_graph Get the number of nodes between the root and each node in a depth first search

0 commit comments

Comments
 (0)