Learn R Programming

gRain (version 0.3.0)

grash-operations: Operations on undirected and directed acyclic graphs.

Description

Make operations on undirected and directed acyclic graphs.

Usage

moralize(dag)
mcs(ug,amat=as.adjmat(ug), vn=colnames(amat), root=NULL, index=FALSE)
triangulate(ug,method="standard", nLevels, matrix=FALSE)
ripOrder(ug,root=NULL,nLevels=NULL)
jTree(ug, method="standard", vn=nodes(ug),nLevels, control=list())

Arguments

dag
A directed graph (of class "dagsh")
ug
An undirected graph (of class "ugsh")
method
The triangulation method, "standard" is a C implementation of a minimum clique weight heuristic, "mcwh" is a Fortran implementation of the same (kindly provided by Peter Green) and "R" is a correspondi
matrix
Should the triangulated graph be returned as an adjacency matrix
amat
The graph represented as an adjancecy matrix
vn
The node names as they appear in the adjancecy matrix
root
Variables which must be in the first clique in the rip-ordering
nLevels
Number of levels of the nodes in the graph
index
If TRUE, then a permutation is returned
control
Currently not used
...
Currently not used.

Value

  • moralize and triangulate returns objects of class "graphsh". mcs returns a vector or NULL. ripOrder returns a list with cliques, separators etc.

Details

The jTree (for "junction tree") is just a wrapper for a call of triangulate followed by a call of ripOrder.

See Also

newugsh, newug, newdagsh, newdag

Examples

Run this code
## Undirected graphs
##
ug <- newug(~me+ve,~me+al,~ve+al,~al+an,~al+st,~an+st)
edges(ug)
nodes(ug)
mcs(ug)
ripOrder(ug)

## Directed graphs
##
dag <- newdag(~me+ve,~me+al,~ve+al,~al+an,~al+st,~an+st)
edges(dag)
nodes(dag)
moralize(dag)

Run the code above in your browser using DataLab