graph-operations2 {gRbase} | R Documentation |
Make operations on undirected and directed acyclic graphs.
MCS(object, root=NULL, index=FALSE) MCSMAT(amat, vn = colnames(amat), root = NULL, index = FALSE) RIP(object,root=NULL,nLevels=NULL) RIPMAT(amat, root = NULL, nLevels = NULL) moralize(object) jTree(object, method="mcwh", nLevels=rep(2,length(nodes(object))),control=list())
object |
An undirected graph (of class "graphNEL") |
root |
Variables to be considered first when doing the orderings |
index |
If TRUE, then a permutation is returned |
nLevels |
Number of levels of the nodes in the graph |
amat |
Adjacency matrix (symmetrical) for undirected graph |
vn |
Nodes in the graph given by adjacency matrix |
method |
The triangulation method, "mcwh" is a C
implementation of a minimum clique weight heuristic,
"R" is a corresponding R
implementation (experimental) |
control |
Currently not used |
The RIP
and RIPMAT
functions return a RIP ordering of
the cliques. This is obtained by first ordering the variables linearly
with maximum cardinality search (by MCS
). The root argument is
transfered to MCS
as a way of controlling which clique will be
the first in the RIP ordering.
The jTree (for "junction tree") is just a wrapper for a call of
triangulate
followed by a call of RIP
.
moralize
and triangulate
returns objects of class
"graphsh".
MCS
and MCSMAT
return a vector with a linear ordering
(obtained by maximum cardinality search) of the variables or
character(0) if such an ordering can not be created.
RIP
and RIPMAT
returns a list with cliques, separators
etc. if a RIP ordering can be made and an empty list if not.
Søren Højsgaard, sorenh@agrsci.dk
## Undirected graphs ## ugr <- ug(~me+ve,~me+al,~ve+al,~al+an,~al+st,~an+st) edges(ugr) nodes(ugr) MCS(ugr) MCSMAT(as.adjMAT(ugr)) RIP(ugr) RIPMAT(as.adjMAT(ugr)) ## Directed graphs ## dagr <- dag(~me+ve,~me+al,~ve+al,~al+an,~al+st,~an+st) edges(dagr) nodes(dagr) moralize(dagr)