These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_random() marks one or more nodes at random.

  • node_is_max() and node_is_min() are more generally useful for converting the results from some node measure into a mark-class object. They can be particularly useful for highlighting which node or nodes are key because they minimise or, more often, maximise some measure.

node_is_random(.data, select = 1)

node_is_max(node_measure, ranks = 1)

node_is_min(node_measure, ranks = 1)

node_is_mean(node_measure, ranks = 1)

Arguments

.data

A network object of class mnet, igraph, tbl_graph, network, or similar. For more information on the standard coercion possible, see manynet::as_tidygraph().

select

Number of elements to select (as TRUE).

node_measure

An object created by a node_ measure.

ranks

The number of ranks of max or min to return. For example, ranks = 3 will return TRUE for nodes with scores equal to any of the top (or, for node_is_min(), bottom) three scores. By default, ranks = 1.

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Examples

node_is_random(ison_brandes, 2)
#>   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10   V11  
#> 1 FALSE FALSE FALSE FALSE TRUE  FALSE FALSE FALSE TRUE  FALSE FALSE
node_is_max(node_by_degree(ison_brandes))
#>   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10   V11  
#> 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE  FALSE FALSE
node_is_min(node_by_degree(ison_brandes))
#>   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10   V11  
#> 1 TRUE  TRUE  FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE  TRUE 
node_is_mean(node_by_degree(ison_brandes))
#>   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10   V11  
#> 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE