Skip to main content

Get all edges in a graph

Source: R/construction.R, R/jlbind-wrappers.R

Description

Lists every edge of cg with its type.

Usage

edges(cg)

Arguments

cg A graph created with cgraph(), of any class.

Value

A data frame with one row per edge and columns from, to (node names) and type (the edge’s notation, e.g. "-->", "---", "<->", "o->", "o--", or "o-o" — see edge-operators), or zero rows if the graph has no edges.

Examples

dag <- cgraph(A %-->% B, B %-->% C)
edges(dag)
#>   from to type
#> 1    A  B  -->
#> 2    B  C  -->

pag <- cgraph(A %o-o% B, class = "PAG")
edges(pag)
#>   from to type
#> 1    A  B  o-o