node_types {tidygraph}R Documentation

Querying node types

Description

These functions all lets the user query whether each node is of a certain type. All of the functions returns a logical vector indicating whether the node is of the type in question. Do note that the types are not mutually exclusive and that nodes can thus be of multiple types.

Usage

node_is_cut()

node_is_root()

node_is_leaf()

node_is_sink()

node_is_source()

node_is_isolated()

node_is_universal(mode = "out")

node_is_simplical(mode = "out")

node_is_center(mode = "out")

Arguments

mode

The way edges should be followed in the case of directed graphs.

Value

A logical vector of the same length as the number of nodes in the graph.

Functions

Examples

# Find the root and leafs in a tree
create_tree(40, 2) %>%
  mutate(root = node_is_root(), leaf = node_is_leaf())

[Package tidygraph version 1.0.0 Index]