Learn R Programming

pcalg (version 2.4-3)

getGraph: Get the "graph" Part or Aspect of R Object

Description

Get the graph part or “aspect” of an R object, notably from our pc(), skeleton(), fci(), etc, results.

Usage

getGraph(x)

Arguments

x
potentially any R object which can be interpreted as a graph (with nodes and edges).

Value

a graph object, i.e., one inheriting from (the virtual) class "graph", package graph.

Methods

For sparseMatrix methods, see the ‘Note’.

See Also

fci, etc. The graph class description in package graph.

Examples

Run this code
A <- rbind(c(0,1,0,0,1),
           c(0,0,0,1,1),
           c(1,0,0,1,0),
           c(1,0,0,0,1),
           c(0,0,0,1,0))
sum(A) # 9
getGraph(A) ## a graph with 5 nodes and  'sum(A)' edges

Run the code above in your browser using DataLab