Extract graph attributes
graph.Rd
Extract node or edge attributes from a tidygraph tbl_graph
object.
Examples
a_graph <- tidygraph::tbl_graph(
nodes = data.frame(
name = c('a','b','c')
),
edges = data.frame(
from = c(1,2),
to = c(2,3),
type = c(1,2)
))
## Extract graph nodes
nodes(a_graph)
#> # A tibble: 3 × 1
#> name
#> <chr>
#> 1 a
#> 2 b
#> 3 c
## Extract graph edges
edges(a_graph)
#> # A tibble: 2 × 1
#> type
#> <dbl>
#> 1 1
#> 2 2