diff --git a/R/map.R b/R/map.R index 711511b..4cb66d5 100644 --- a/R/map.R +++ b/R/map.R @@ -421,13 +421,13 @@ map_local_dbl <- function(order = 1, mode = 'all', mindist = 0, .f, ...) { #' @importFrom tibble tibble bfs_df <- function(graph, root, mode, unreachable) { search <- bfs(graph = graph, root = root, mode = mode, unreachable = unreachable, - order = TRUE, rank = TRUE, father = TRUE, pred = TRUE, + order = TRUE, rank = TRUE, parent = TRUE, pred = TRUE, succ = TRUE, dist = TRUE) nodes <- seq_along(search$order) tibble( node = nodes, rank = as.integer(search$rank), - parent = as.integer(search$father), + parent = as.integer(search$parent), before = as.integer(search$pred), after = as.integer(search$succ), dist = as.integer(search$dist), @@ -438,13 +438,13 @@ bfs_df <- function(graph, root, mode, unreachable) { #' @importFrom tibble tibble dfs_df <- function(graph, root, mode, unreachable) { search <- dfs(graph = graph, root = root, mode = mode, unreachable = unreachable, - order = TRUE, order.out = TRUE, father = TRUE, dist = TRUE) + order = TRUE, order.out = TRUE, parent = TRUE, dist = TRUE) nodes <- seq_along(search$order) tibble( node = nodes, rank = match(nodes, as.integer(search$order)), rank_out = match(nodes, as.integer(search$order.out)), - parent = as.integer(search$father), + parent = as.integer(search$parent), dist = as.integer(search$dist), result = rep(list(NULL), length(nodes)) ) diff --git a/R/morphers.R b/R/morphers.R index 8a733b2..a6a69f8 100644 --- a/R/morphers.R +++ b/R/morphers.R @@ -217,7 +217,7 @@ to_shortest_path <- function(graph, from, to, mode = 'out', weights = NULL) { to_bfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) { root <- eval_tidy(enquo(root), as_tibble(graph, 'nodes')) root <- as_node_ind(root, graph) - search <- bfs(graph, root, mode = mode, unreachable = unreachable, father = TRUE) + search <- bfs(graph, root, mode = mode, unreachable = unreachable, parent = TRUE) bfs_graph <- search_to_graph(graph, search) list( bfs = bfs_graph @@ -230,7 +230,7 @@ to_bfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) { to_dfs_tree <- function(graph, root, mode = 'out', unreachable = FALSE) { root <- eval_tidy(enquo(root), as_tibble(graph, 'nodes')) root <- as_node_ind(root, graph) - search <- dfs(graph, root, mode = mode, unreachable = unreachable, father = TRUE) + search <- dfs(graph, root, mode = mode, unreachable = unreachable, parent = TRUE) dfs_graph <- search_to_graph(graph, search) list( dfs = dfs_graph @@ -340,7 +340,7 @@ to_hierarchical_clusters <- function(graph, method = 'walktrap', weights = NULL, search_to_graph <- function(graph, search) { nodes <- as_tibble(graph, active = 'nodes') - edges <- tibble(from = search$father, to = seq_len(nrow(nodes))) + edges <- tibble(from = search$parent, to = seq_len(nrow(nodes))) edges <- edges[!is.na(edges$from), , drop = FALSE] tbl_graph(nodes, edges) } diff --git a/R/search.R b/R/search.R index 1a81bfd..6b22e83 100644 --- a/R/search.R +++ b/R/search.R @@ -56,7 +56,7 @@ bfs_parent <- function(root, mode = 'out', unreachable = FALSE) { graph <- .G() root <- as_node_ind(root, graph) ind <- bfs(graph = graph, root = root, mode = mode, unreachable = unreachable, - order = TRUE, father = TRUE)$father + order = TRUE, parent = TRUE)$parent as.integer(ind)[focus_ind(graph, 'nodes')] } #' @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) { graph <- .G() root <- as_node_ind(root, graph) ind <- dfs(graph = graph, root = root, mode = mode, unreachable = unreachable, - order = TRUE, father = TRUE)$father + order = TRUE, parent = TRUE)$parent as.integer(ind)[focus_ind(graph, 'nodes')] } #' @describeIn search_graph Get the number of nodes between the root and each node in a depth first search