is_edge_loop: Is the edge a loop edge?

Description Usage Arguments Value Examples

View source: R/is_edge_loop.R

Description

Determines whether an edge definition is a loop edge.

Usage

1
is_edge_loop(graph, edge)

Arguments

graph

A graph object of class dgr_graph.

edge

A numeric edge ID value.

Value

A logical value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Create a graph that has multiple
# loop edges
graph <-
  create_graph() %>%
  add_path(n = 4) %>%
  add_edge(
    from = 1,
    to = 1) %>%
  add_edge(
    from = 3,
    to = 3)

# Get the graph's internal
# edge data frame
graph %>% get_edge_df()

# Determine if edge `4` is
# a loop edge
graph %>% is_edge_loop(edge = 4)

# Determine if edge `2` is
# a loop edge
graph %>% is_edge_loop(edge = 2)

DiagrammeR documentation built on July 2, 2020, 3:19 a.m.