edge_info: Get detailed information on edges

Description Usage Arguments Value Examples

View source: R/edge_info.R

Description

Obtain a data frame with detailed information on edges and their interrelationships within a graph.

Usage

1
edge_info(graph)

Arguments

graph

a graph object of class dgr_graph.

Value

a data frame containing information specific to each edge within the graph.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Create a node data frame (ndf)
ndf <-
  create_node_df(
    n = 4,
    label = TRUE,
    type = c("A", "A", "B", "C"))

# Create an edge data frame (edf)
edf <-
  create_edge_df(
    from = c(1, 3, 3, 4),
    to = c(2, 2, 1, 3),
    rel = c("X", "Y", "Y", "Z"))

# Create a graph using the ndf and edf
graph <-
  create_graph(
    nodes_df = ndf,
    edges_df = edf)

# Get a data frame with information about
# the graph's edges
edge_info(graph)
#>   id from to rel
#> 1  1    1  2   X
#> 2  2    3  2   Y
#> 3  3    3  1   Y
#> 4  4    4  3   Z

DiagrammeR documentation built on Sept. 7, 2017, 1:06 a.m.