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.

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")

node_is_adjacent(to, mode = "all", include_to = TRUE)

node_is_keyplayer(k, p = 0, tol = 1e-04, maxsec = 120, roundsec = 30)

node_is_connected(nodes, mode = "all", any = FALSE)

## Arguments

mode

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

to

The nodes to test for adjacency to

include_to

Should the nodes in to be marked as adjacent as well

k

The number of keyplayers to identify

p

The probability to accept a lesser state

tol

Optimisation tolerance, below which the optimisation will stop

maxsec

The total computation budget for the optimization, in seconds

roundsec

Number of seconds in between synchronizing workers' answer

nodes

The set of nodes to test connectivity to. Can be a list to use different sets for different nodes. If a list it will be recycled as necessary.

any

Logical. If TRUE the node only needs to be connected to a single node in the set for it to return TRUE

## Value

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

## Functions

• node_is_cut(): is the node a cut node (articaultion node)

• node_is_root(): is the node a root in a tree

• node_is_leaf(): is the node a leaf in a tree

• node_is_sink(): does the node only have incomming edges

• node_is_source(): does the node only have outgoing edges

• node_is_isolated(): is the node unconnected

• node_is_universal(): is the node connected to all other nodes in the graph

• node_is_simplical(): are all the neighbors of the node connected

• node_is_center(): does the node have the minimal eccentricity in the graph

• node_is_adjacent(): is a node adjacent to any of the nodes given in to

• node_is_keyplayer(): Is a node part of the keyplayers in the graph (influenceR)

• node_is_connected(): Is a node connected to all (or any) nodes in a set

## Examples

# Find the root and leafs in a tree
create_tree(40, 2) %>%
mutate(root = node_is_root(), leaf = node_is_leaf())
#> # A tbl_graph: 40 nodes and 39 edges
#> #
#> # A rooted tree
#> #
#> # Node Data: 40 × 2 (active)
#>    root  leaf
#>    <lgl> <lgl>
#>  1 TRUE  FALSE
#>  2 FALSE FALSE
#>  3 FALSE FALSE
#>  4 FALSE FALSE
#>  5 FALSE FALSE
#>  6 FALSE FALSE
#>  7 FALSE FALSE
#>  8 FALSE FALSE
#>  9 FALSE FALSE
#> 10 FALSE FALSE
#> # ℹ 30 more rows
#> #
#> # Edge Data: 39 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     2     4
#> # ℹ 36 more rows