Learn R Programming

gRbase (version 1.6-4)

triangulate: Triangulation of an undirected graph

Description

This function will triangulate an undirected graph by adding fillins.

Usage

triangulate(object, ...)
## S3 method for class 'graphNEL':
triangulate(object, method="mcwh",  nLevels = rep(2,length(nodes(object))), result="graphNEL",...)
## S3 method for class 'igraph':
triangulate(object, method="mcwh",  nLevels = rep(2,length(V(object))), result="igraph",...)
## S3 method for class 'matrix':
triangulate(object, method="mcwh",  nLevels = rep(2,ncol(object)), result="matrix",...)
triangulateMAT(amat, method="mcwh", nLevels=rep(2,ncol(amat)), result=NULL, ...)

Arguments

object
An undirected graph represented either as a 'graphNEL', a 'matrix' or an 'igraph'.
method
Triangulation method. Either "mcwh" (minimum clique weight heuristic) which is implemented in C or "r" (an experimental R version)
nLevels
Typically, the number of levels of the variables (nodes) when these are discrete. Used in determining the triangulation using a "minimum clique weight heuristic". See section 'details'.
result
The type (representation) of the result. Possible values are 'graphNEL', 'matrix', 'Matrix' and 'igraph'. Default is the same type as the input graph.
...
Additional arguments, currently not used.
amat
Adjacency matrix

Value

  • A triangulated graph represented either as a 'graphNEL', a 'matrix' or an 'igraph'.

Details

The triangulation is made so as the total state space is kept low by applying a minimum clique weight heuristic.

See Also

ug dag mcs rip moralize

Examples

Run this code
## graphNEL
uG1 <- ug(~a:b+b:c+c:d+d:e+e:f+f:a)
tuG1 <- triangulate(uG1)

## adjacency matrix
uG2 <- ug(~a:b+b:c+c:d+d:e+e:f+f:a, result="matrix")
tuG2 <- triangulate(uG2)

## igraph
uG3 <- ug(~a:b+b:c+c:d+d:e+e:f+f:a, result="igraph")
tuG3 <- triangulate(uG3)

Run the code above in your browser using DataLab