These functions lets the user query whether the edges in a graph is of a specific type. All functions return a logical vector giving whether each edge in the graph corresponds to the specific type.

edge_is_multiple()

edge_is_loop()

edge_is_mutual()

edge_is_from(from)

edge_is_to(to)

edge_is_between(from, to, ignore_dir = !graph_is_directed())

edge_is_incident(nodes)

edge_is_bridge()

edge_is_feedback_arc(weights = NULL, approximate = TRUE)

Arguments

from, to, nodes

A vector giving node indices

ignore_dir

Is both directions of the edge allowed

weights

The weight of the edges to use for the calculation. Will be evaluated in the context of the edge data.

approximate

Should the minimal set be approximated or exact

Value

A logical vector of the same length as the number of edges in the graph

Functions

  • edge_is_multiple(): Query whether each edge has any parallel siblings

  • edge_is_loop(): Query whether each edge is a loop

  • edge_is_mutual(): Query whether each edge has a sibling going in the reverse direction

  • edge_is_from(): Query whether an edge goes from a set of nodes

  • edge_is_to(): Query whether an edge goes to a set of nodes

  • edge_is_between(): Query whether an edge goes between two sets of nodes

  • edge_is_incident(): Query whether an edge goes from or to a set of nodes

  • edge_is_bridge(): Query whether an edge is a bridge (ie. it's removal will increase the number of components in a graph)

  • edge_is_feedback_arc(): Query whether an edge is part of the minimal feedback arc set (its removal together with the rest will break all cycles in the graph)

Examples

create_star(10, directed = TRUE, mutual = TRUE) %>%
  activate(edges) %>%
  sample_frac(0.7) %>%
  mutate(single_edge = !edge_is_mutual())
#> `.env` is deprecated and no longer has any effect
#> # A tbl_graph: 10 nodes and 13 edges
#> #
#> # A directed simple graph with 3 components
#> #
#> # Edge Data: 13 × 3 (active)
#>     from    to single_edge
#>    <int> <int> <lgl>      
#>  1     1     2 FALSE      
#>  2     2     1 FALSE      
#>  3     1     3 FALSE      
#>  4     3     1 FALSE      
#>  5     1     4 TRUE       
#>  6     1     5 FALSE      
#>  7     5     1 FALSE      
#>  8     1     8 FALSE      
#>  9     8     1 FALSE      
#> 10     1     9 FALSE      
#> 11     9     1 FALSE      
#> 12     1    10 FALSE      
#> 13    10     1 FALSE      
#> #
#> # Node Data: 10 × 0