Learn R Programming

tidygraph (version 0.1.0)

edge_types: Querying edge types

Description

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.

Usage

edge_is_multiple()

edge_is_loop()

edge_is_mutual()

Arguments

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

Examples

Run this code
create_star(10, directed = TRUE, mutual = TRUE) %>%
  activate(edges) %>%
  sample_frac(0.7) %>%
  mutate(single_edge = !edge_is_mutual())

Run the code above in your browser using DataLab