Learn R Programming

gRapHD (version 0.2.5)

perfSets: Finds a perfect sequence

Description

Finds a perfect sequence, returning the cliques, histories, residuals, and separators of a given triangulated graph.

Usage

perfSets(model=NULL,edges=NULL,p=NULL,varType=0,from=0)

Arguments

model

gRapHD object.

edges

matrix with 2 columns, each row representing one edge, and each column one of the vertices in the edge.

p

number of vertices.

varType

vector indicating the type of each variable: 0 if continuous, or 1 if discrete.

from

initial vertex to be used in MCS.

Value

A list containing:

cliques

list.

histories

list.

residuals

list.

separators

list.

Details

Based on the perfect numbering of mcs, returns the perfect sequnece. The sequence is given by the cliques in the graph: \(C_j=closure(\alpha_j)\cap\{\alpha_1,...,\alpha_j\}\), \(j\ge1\). The other sets are given by: - Histories: \(H_j=C_1\cup...\cup C_j\) - Residuals: \(R_j=C_j\backslash H_{j-1}\) - Separators: \(S_j=H_{j-1}\cap C_j\)

References

Lauritzen, S.L. (1996) Graphical Models, Oxford University Press.

Examples

Run this code
# NOT RUN {
edges <- matrix(c(1,2,2,3,2,4,2,5,2,6,3,4,4,5,5,6),ncol=2,byrow=TRUE)
setList <- perfSets(edges=edges, p=6, varType=0, from=1)
#    > str(setList)
#    List of 4
#     $ cliques   :List of 4
#      ..$ : int [1:2] 1 2
#      ..$ : int [1:3] 2 3 4
#      ..$ : int [1:3] 2 4 5
#      ..$ : int [1:3] 2 5 6
#     $ histories :List of 4
#      ..$ : int [1:2] 1 2
#      ..$ : int [1:4] 1 2 3 4
#      ..$ : int [1:5] 1 2 3 4 5
#      ..$ : int [1:6] 1 2 3 4 5 6
#     $ separators:List of 4
#      ..$ : NULL
#      ..$ : int 2
#      ..$ : int [1:2] 2 4
#      ..$ : int [1:2] 2 5
#     $ residuals :List of 4
#      ..$ : int [1:2] 1 2
#      ..$ : int [1:2] 3 4
#      ..$ : int 5
#      ..$ : int 6
# }

Run the code above in your browser using DataLab