Evaluate the expression in tidygraph::filter(expr) and return the indices of the remaining nodes

get_node_index(gr, expr)

Arguments

gr

tidygraph graph object

expr

an expression to evaluate in tidygraph::filter(expr)

Value

a vector of the indices of the nodes remaining after the filter

Examples

suppressPackageStartupMessages(library(magrittr)) suppressPackageStartupMessages(library(tidygraph)) tidygraph::create_ring(5) %>% mutate(name = LETTERS[1:5]) %>% get_node_index(name != "B")
#> [1] 1 3 4 5