Learn R Programming

gRbase (version 1.3.9)

graph-operations2: More advanced operations on undirected and directed acyclic graphs.

Description

Make operations on undirected and directed acyclic graphs.

Usage

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)
moralizeMAT(amat)
maxCliqueMAT(amat)
jTree(object, method="mcwh", nLevels=rep(2,length(nodes(object))),control=list())

Arguments

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
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

Value

  • 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.

Details

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.

See Also

ug, dag

Examples

Run this code
## Undirected graphs
##
ugr <- ug(~me+ve,~me+al,~ve+al,~al+an,~al+st,~an+st)
ugm <- as.adjMAT(ugr)
edges(ugr)
nodes(ugr)
mcs(ugr)
mcsMAT(ugm)
rip(ugr)
ripMAT(ugm)

maxClique(ugr)
maxCliqueMAT(ugm)

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

Run the code above in your browser using DataLab