graph-coerce: Graph coercion

Description Usage Arguments Details Examples

Description

Methods for changing graph representations

Usage

1
2
3
coerceGraph(object, class)

graph_as(object, outtype, intype = NULL)

Arguments

object

A graph object

class

The desired output class

outtype

The desired output outtype

intype

The desired output outtype (only relevant if object is a list)

Details

coerceGraph is used in the book "Graphical models with R". A more generic approach is as().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
g1 <- ug(~a:b+b:c)
as(g1, "igraph")
as(g1, "matrix")
as(g1, "Matrix")
as(g1, "dgCMatrix")

## graph_as(g1, "ugList") ## Fails
## getCliques(g1)         ## Works

l1 <- list(c("a" ,"b"), c("b", "c"))
graph_as(l1, "graphNEL", "ugList")

DataSciBurgoon/gRbase documentation built on March 25, 2020, 12:03 a.m.