get_node_index: Get the indices of nodes after evaluating 'expr'

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

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

Usage

1
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

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

jhrcook/wext documentation built on May 17, 2021, 1:19 a.m.