### network.R

## Graphical model from Dawid and Evett (1997)
## http://www.math.leidenuniv.nl/~gillrd/teaching/graphical/DawidEvett.net
## http://www.math.leidenuniv.nl/~gillrd/teaching/graphical/DawidEvettSN.net
## http://www.math.leidenuniv.nl/~gillrd/teaching/graphical/layout.dat

## "SN" stands for "short names", better for these plots
## "layout.dat" contains a nice (hand-made) graphical layout for the graph


# Load packages, input network, compile and propagate, first plots

library(Rgraphviz)
## Loading required package: graph
## Loading required package: grid
library(gRain)
## Loading required package: gRbase
network <- loadHuginNet("DawidEvettSN.net")
plot(network)

network
## Independence network: Compiled: FALSE Propagated: FALSE 
##   Nodes: chr [1:13] "N" "C" "W" "G1" "B" "A" "X1" "X2" "G2" ...
names(network)
##  [1] "universe"      "data"          "dag"           "cptlist"      
##  [5] "isInitialized" "isCompiled"    "isPropagated"  "finding"      
##  [9] "control"       "details"
# str(network) 
networkC <- compile(network)
networkC
## Independence network: Compiled: TRUE Propagated: FALSE 
##   Nodes: chr [1:13] "N" "C" "W" "G1" "B" "A" "X1" "X2" "G2" ...
names(networkC)
##  [1] "universe"      "data"          "dag"           "cptlist"      
##  [5] "isInitialized" "isCompiled"    "isPropagated"  "finding"      
##  [9] "control"       "details"       "rip"           "ug"           
## [13] "equilCQpot"    "tempCQpot"     "origCQpot"     "details"
networkCP <- propagate(networkC)
plot(networkCP)

networkCP
## Independence network: Compiled: TRUE Propagated: TRUE 
##   Nodes: chr [1:13] "N" "C" "W" "G1" "B" "A" "X1" "X2" "G2" ...
names(networkCP)
##  [1] "universe"      "data"          "dag"           "cptlist"      
##  [5] "isInitialized" "isCompiled"    "isPropagated"  "finding"      
##  [9] "control"       "details"       "rip"           "ug"           
## [13] "equilCQpot"    "tempCQpot"     "origCQpot"     "details"
# str(networkCP)

# Plot various graphs from the compiled grain object
# (How to get the layouts of the first two the same?)
# (How to identify the cliques in the last one?)

par(mfrow=c(2,2))
plot(networkCP$dag)
plot(networkCP$ug)
plot(networkCP$rip)
par(mfrow=c(1,1))

# Compute these graphs manually

g <- network$dag
mg <- moralize(g)
tmg <- triangulate(mg)
jt <- rip(tmg)
# jt   ## Strangely, doesn't work in knitr

# summary(jt)  ## Not what I would expect
names(jt)
## [1] "nodes"      "cliques"    "separators" "parents"    "children"  
## [6] "host"       "nLevels"    "childList"
jt$cliques
## [[1]]
## [1] "B" "N" "C"
## 
## [[2]]
## [1] "A" "N" "C"
## 
## [[3]]
## [1] "W" "C"
## 
## [[4]]
## [1] "G1" "N" 
## 
## [[5]]
## [1] "B"  "R"  "X1" "X2" "Y2"
## 
## [[6]]
## [1] "B"  "R"  "G2"
## 
## [[7]]
## [1] "A"  "X3" "Y1"
jt$parents
## [1] 0 1 2 2 1 5 2
# Plot them

par(mfrow=c(2,2))
plot(g)
plot(mg)
plot(tmg)
plot(jt)

par(mfrow=c(1,1))

# Two other packges

library(igraph)
## 
## Attaching package: 'igraph'
## 
## The following objects are masked from 'package:graph':
## 
##     degree, edges
Sys.setenv(HUGINHOME = "/Applications/HDE7.7-x64")
library(RHugin)
## 
## Attaching package: 'RHugin'
## 
## The following object is masked from 'package:igraph':
## 
##     get.edges
## 
## The following objects are masked from 'package:gRbase':
## 
##     compile, propagate, triangulate
# Plotting using igraph

gig <- as(g, "igraph")
plot(gig)

layout <- read.table("layout.dat", stringsAsFactors=FALSE)
rownames(layout) <- layout$V1
layout$V1 <- NULL
colnames(layout) <- c("x1", "y1", "x2", "y2")
layout <- layout[V(gig)$label, ]

V(gig)$x <- (layout$x1 + layout$x2)/2
V(gig)$y <- -(layout$y1 + layout$y2)/2
V(gig)$size <- 20
plot(gig)

tmgig <- as(tmg, "igraph")
V(tmgig)$x <- V(gig)$x
V(tmgig)$y <- V(gig)$y

V(tmgig)$size <- 20

plot(tmgig)

# Plotting the junction tree


Ncliques <- length(jt$cliques)
clilab <- character(Ncliques)
for (i in 1:Ncliques) clilab[i] <- paste(jt$cliques[[i]], collapse=" ")

childList <- jt$childList
names(childList) <- NULL
parentList <- list()
parentList[1] <- integer(0)
for (i in 2:Ncliques) parentList[i] <- jt$parents[i]

jtel <- vector("list", length=7)
names(jtel) <- clilab
for(i in 1:Ncliques) jtel[[i]] <- list(edges = c(childList[[i]], parentList[[i]]))
jtg <- graphNEL(nodes=clilab, edgeL = jtel, edgemode="undirected")
plot(jtg)

# Is a graph triangulated?

library(RBGL)
## 
## Attaching package: 'RBGL'
## 
## The following object is masked from 'package:igraph':
## 
##     transitivity
is.triangulated(mg)
## [1] TRUE
# What is there in a grain object (and in a rip)?

str(jt)
## List of 8
##  $ nodes     : chr [1:13] "N" "C" "B" "A" ...
##  $ cliques   :List of 7
##   ..$ : chr [1:3] "B" "N" "C"
##   ..$ : chr [1:3] "A" "N" "C"
##   ..$ : chr [1:2] "W" "C"
##   ..$ : chr [1:2] "G1" "N"
##   ..$ : chr [1:5] "B" "R" "X1" "X2" ...
##   ..$ : chr [1:3] "B" "R" "G2"
##   ..$ : chr [1:3] "A" "X3" "Y1"
##  $ separators:List of 7
##   ..$ : chr(0) 
##   ..$ : chr [1:2] "N" "C"
##   ..$ : chr "C"
##   ..$ : chr "N"
##   ..$ : chr "B"
##   ..$ : chr [1:2] "B" "R"
##   ..$ : chr "A"
##  $ parents   : int [1:7] 0 1 2 2 1 5 2
##  $ children  : int [1:7] 2 3 NA NA 6 NA NA
##  $ host      : int [1:13] 4 3 6 7 3 4 5 5 6 5 ...
##  $ nLevels   : NULL
##  $ childList :List of 7
##   ..$ 1: int [1:2] 2 5
##   ..$ 2: int [1:3] 3 4 7
##   ..$ 3: int(0) 
##   ..$ 4: int(0) 
##   ..$ 5: int 6
##   ..$ 6: int(0) 
##   ..$ 7: int(0) 
##  - attr(*, "class")= chr "ripOrder"
str(networkCP)
## List of 16
##  $ universe     :List of 3
##   ..$ nodes : chr [1:13] "N" "C" "W" "G1" ...
##   ..$ levels:List of 13
##   .. ..$ N : chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..$ C : chr [1:2] "Yes" "No"
##   .. ..$ W : chr [1:2] "Suspect_was_offender" "Suspect_not_offender"
##   .. ..$ G1: chr [1:2] "Says_4" "Says_other"
##   .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. ..$ A : chr [1:2] "Suspect" "Other"
##   .. ..$ X1: chr [1:2] "Special" "Other"
##   .. ..$ X2: chr [1:2] "Special" "Other"
##   .. ..$ G2: chr [1:2] "Yes" "No"
##   .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. ..$ Y2: chr [1:2] "Special" "Other"
##   .. ..$ X3: chr [1:2] "Special" "Other"
##   .. ..$ Y1: chr [1:2] "Special" "Other"
##   ..$ nlev  : Named int [1:13] 3 2 2 2 2 2 2 2 2 2 ...
##   .. ..- attr(*, "names")= chr [1:13] "N" "C" "W" "G1" ...
##  $ data         : NULL
##  $ dag          :Formal class 'graphNEL' [package "graph"] with 6 slots
##   .. ..@ nodes     : chr [1:13] "N" "C" "W" "G1" ...
##   .. ..@ edgeL     :List of 13
##   .. .. ..$ N :List of 1
##   .. .. .. ..$ edges: int [1:4] 2 4 5 6
##   .. .. ..$ C :List of 1
##   .. .. .. ..$ edges: int [1:3] 3 5 6
##   .. .. ..$ W :List of 1
##   .. .. .. ..$ edges: num(0) 
##   .. .. ..$ G1:List of 1
##   .. .. .. ..$ edges: num(0) 
##   .. .. ..$ B :List of 1
##   .. .. .. ..$ edges: int [1:2] 10 11
##   .. .. ..$ A :List of 1
##   .. .. .. ..$ edges: int 13
##   .. .. ..$ X1:List of 1
##   .. .. .. ..$ edges: int 11
##   .. .. ..$ X2:List of 1
##   .. .. .. ..$ edges: int 11
##   .. .. ..$ G2:List of 1
##   .. .. .. ..$ edges: int 10
##   .. .. ..$ R :List of 1
##   .. .. .. ..$ edges: int 11
##   .. .. ..$ Y2:List of 1
##   .. .. .. ..$ edges: num(0) 
##   .. .. ..$ X3:List of 1
##   .. .. .. ..$ edges: int 13
##   .. .. ..$ Y1:List of 1
##   .. .. .. ..$ edges: num(0) 
##   .. ..@ edgeData  :Formal class 'attrData' [package "graph"] with 2 slots
##   .. .. .. ..@ data    :List of 15
##   .. .. .. .. ..$ N|C  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|G1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|B  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|A  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|W  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|B  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|A  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|R  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|Y2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ A|Y1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X1|Y2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X2|Y2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ G2|R :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|Y2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X3|Y1:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. ..@ defaults:List of 1
##   .. .. .. .. ..$ weight: num 1
##   .. ..@ nodeData  :Formal class 'attrData' [package "graph"] with 2 slots
##   .. .. .. ..@ data    : list()
##   .. .. .. ..@ defaults: list()
##   .. ..@ renderInfo:Formal class 'renderInfo' [package "graph"] with 4 slots
##   .. .. .. ..@ nodes: list()
##   .. .. .. ..@ edges: list()
##   .. .. .. ..@ graph: list()
##   .. .. .. ..@ pars : list()
##   .. ..@ graphData :List of 1
##   .. .. ..$ edgemode: chr "directed"
##  $ cptlist      :List of 13
##   ..$ N : parray [1:3(1d)] 0 1 0
##   .. ..- attr(*, "dimnames")=List of 1
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ C : parray [1:2, 1:3] 0.5 0.5 0.0099 0.9901 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ W : parray [1:2, 1:2] 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ W: chr [1:2] "Suspect_was_offender" "Suspect_not_offender"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ G1: parray [1:2, 1:3] 0.5 0.5 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ G1: chr [1:2] "Says_4" "Says_other"
##   .. .. ..$ N : chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ B : parray [1:2, 1:2, 1:3] 0.5 0.5 0.5 0.5 0.25 0.75 0 1 0.5 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ B: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ A : parray [1:2, 1:2, 1:3] 0.5 0.5 0.5 0.5 0.25 0.75 0 1 0.5 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ A: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ X1: parray [1:2(1d)] 0.01 0.99
##   .. ..- attr(*, "dimnames")=List of 1
##   .. .. ..$ X1: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ X2: parray [1:2(1d)] 0.01 0.99
##   .. ..- attr(*, "dimnames")=List of 1
##   .. .. ..$ X2: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ G2: parray [1:2(1d)] 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 1
##   .. .. ..$ G2: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ R : parray [1:2, 1:2, 1:2] 0.9 0.1 0.01 0.99 0.5 0.5 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ G2: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ Y2: parray [1:2, 1:2, 1:2, 1:2, 1:2] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 5
##   .. .. ..$ Y2: chr [1:2] "Special" "Other"
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ X2: chr [1:2] "Special" "Other"
##   .. .. ..$ X1: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ X3: parray [1:2(1d)] 0.01 0.99
##   .. ..- attr(*, "dimnames")=List of 1
##   .. .. ..$ X3: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ Y1: parray [1:2, 1:2, 1:2] 1 0 0 1 0.01 0.99 0.01 0.99
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ Y1: chr [1:2] "Special" "Other"
##   .. .. ..$ X3: chr [1:2] "Special" "Other"
##   .. .. ..$ A : chr [1:2] "Suspect" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##  $ isInitialized: logi TRUE
##  $ isCompiled   : logi TRUE
##  $ isPropagated : logi TRUE
##  $ finding      : NULL
##  $ control      :List of 1
##   ..$ timing: num 0
##  $ details      : num 0
##  $ rip          :List of 8
##   ..$ nodes     : chr [1:13] "N" "C" "B" "A" ...
##   ..$ cliques   :List of 7
##   .. ..$ : chr [1:3] "B" "N" "C"
##   .. ..$ : chr [1:3] "A" "N" "C"
##   .. ..$ : chr [1:2] "W" "C"
##   .. ..$ : chr [1:2] "G1" "N"
##   .. ..$ : chr [1:5] "B" "R" "X1" "X2" ...
##   .. ..$ : chr [1:3] "B" "R" "G2"
##   .. ..$ : chr [1:3] "A" "X3" "Y1"
##   ..$ separators:List of 7
##   .. ..$ : chr(0) 
##   .. ..$ : chr [1:2] "N" "C"
##   .. ..$ : chr "C"
##   .. ..$ : chr "N"
##   .. ..$ : chr "B"
##   .. ..$ : chr [1:2] "B" "R"
##   .. ..$ : chr "A"
##   ..$ parents   : int [1:7] 0 1 2 2 1 5 2
##   ..$ children  : int [1:7] 2 3 NA NA 6 NA NA
##   ..$ host      : int [1:13] 4 3 6 7 3 4 5 5 6 5 ...
##   ..$ nLevels   : num [1:13] 2 2 2 2 2 2 2 2 2 2 ...
##   ..$ childList :List of 7
##   .. ..$ 1: int [1:2] 2 5
##   .. ..$ 2: int [1:3] 3 4 7
##   .. ..$ 3: int(0) 
##   .. ..$ 4: int(0) 
##   .. ..$ 5: int 6
##   .. ..$ 6: int(0) 
##   .. ..$ 7: int(0) 
##   ..- attr(*, "class")= chr "ripOrder"
##  $ ug           :Formal class 'graphNEL' [package "graph"] with 6 slots
##   .. ..@ nodes     : chr [1:13] "N" "C" "W" "G1" ...
##   .. ..@ edgeL     :List of 13
##   .. .. ..$ N :List of 1
##   .. .. .. ..$ edges: int [1:4] 2 4 5 6
##   .. .. ..$ C :List of 1
##   .. .. .. ..$ edges: int [1:4] 1 3 5 6
##   .. .. ..$ W :List of 1
##   .. .. .. ..$ edges: int 2
##   .. .. ..$ G1:List of 1
##   .. .. .. ..$ edges: int 1
##   .. .. ..$ B :List of 1
##   .. .. .. ..$ edges: int [1:7] 1 2 7 8 9 10 11
##   .. .. ..$ A :List of 1
##   .. .. .. ..$ edges: int [1:4] 1 2 12 13
##   .. .. ..$ X1:List of 1
##   .. .. .. ..$ edges: int [1:4] 5 8 10 11
##   .. .. ..$ X2:List of 1
##   .. .. .. ..$ edges: int [1:4] 5 7 10 11
##   .. .. ..$ G2:List of 1
##   .. .. .. ..$ edges: int [1:2] 5 10
##   .. .. ..$ R :List of 1
##   .. .. .. ..$ edges: int [1:5] 5 7 8 9 11
##   .. .. ..$ Y2:List of 1
##   .. .. .. ..$ edges: int [1:4] 5 7 8 10
##   .. .. ..$ X3:List of 1
##   .. .. .. ..$ edges: int [1:2] 6 13
##   .. .. ..$ Y1:List of 1
##   .. .. .. ..$ edges: int [1:2] 6 12
##   .. ..@ edgeData  :Formal class 'attrData' [package "graph"] with 2 slots
##   .. .. .. ..@ data    :List of 44
##   .. .. .. .. ..$ N|C  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|G1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|B  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ N|A  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|N  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|W  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|B  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ C|A  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ W|C  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ G1|N :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|N  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|C  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|X1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|X2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|G2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|R  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ B|Y2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ A|N  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ A|C  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ A|X3 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ A|Y1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X1|B :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X1|X2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X1|R :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X1|Y2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X2|B :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X2|X1:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X2|R :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X2|Y2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ G2|B :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ G2|R :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|B  :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|X1 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|X2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|G2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ R|Y2 :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y2|B :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y2|X1:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y2|X2:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y2|R :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X3|A :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ X3|Y1:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y1|A :List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. .. ..$ Y1|X3:List of 1
##   .. .. .. .. .. ..$ weight: num 1
##   .. .. .. ..@ defaults:List of 1
##   .. .. .. .. ..$ weight: num 1
##   .. ..@ nodeData  :Formal class 'attrData' [package "graph"] with 2 slots
##   .. .. .. ..@ data    : list()
##   .. .. .. ..@ defaults: list()
##   .. ..@ renderInfo:Formal class 'renderInfo' [package "graph"] with 4 slots
##   .. .. .. ..@ nodes: list()
##   .. .. .. ..@ edges: list()
##   .. .. .. ..@ graph: list()
##   .. .. .. ..@ pars : list()
##   .. ..@ graphData :List of 1
##   .. .. ..$ edgemode: chr "undirected"
##  $ equilCQpot   :List of 7
##   ..$ : num [1:3, 1:2, 1:2] 0 0.00248 0 0 0 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ B: chr [1:2] "Suspect" "Other"
##   ..$ : num [1:3, 1:2, 1:2] 0 0.00248 0 0 0 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ A: chr [1:2] "Suspect" "Other"
##   ..$ : num [1:2, 1:2] 0.00792 0.49505 0.00198 0.49505
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ W: chr [1:2] "Suspect_was_offender" "Suspect_not_offender"
##   ..$ : num [1:3, 1:2] 0 0.8 0 0 0.2 0
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ N : chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. .. ..$ G1: chr [1:2] "Says_4" "Says_other"
##   ..$ : num [1:2, 1:2, 1:2, 1:2, 1:2] 8.66e-08 1.27e-05 3.71e-08 3.72e-05 8.66e-08 ...
##   .. ..- attr(*, "dimnames")=List of 5
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ Y2: chr [1:2] "Special" "Other"
##   .. .. ..$ X2: chr [1:2] "Special" "Other"
##   .. .. ..$ X1: chr [1:2] "Special" "Other"
##   ..$ : num [1:2, 1:2, 1:2] 0.001114 0.004988 0.000124 0.493775 0.000619 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ G2: chr [1:2] "Yes" "No"
##   ..$ : num [1:2, 1:2, 1:2] 2.48e-05 9.98e-05 0.00 9.88e-03 0.00 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ A : chr [1:2] "Suspect" "Other"
##   .. .. ..$ Y1: chr [1:2] "Special" "Other"
##   .. .. ..$ X3: chr [1:2] "Special" "Other"
##   ..- attr(*, "pFinding")= num 1
##  $ tempCQpot    :List of 7
##   ..$ : parray [1:2, 1:2, 1:3] 0 0 0 0 0.00248 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ B: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:3] 0.5 0.5 0.5 0.5 0.25 0.75 0 1 0.5 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ A: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2] 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ W: chr [1:2] "Suspect_was_offender" "Suspect_not_offender"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:3] 0.5 0.5 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ G1: chr [1:2] "Says_4" "Says_other"
##   .. .. ..$ N : chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2, 1:2, 1:2] 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00495 0.00495 ...
##   .. ..- attr(*, "dimnames")=List of 5
##   .. .. ..$ Y2: chr [1:2] "Special" "Other"
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ X2: chr [1:2] "Special" "Other"
##   .. .. ..$ X1: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2] 0.45 0.05 0.005 0.495 0.25 0.25 0.25 0.25
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ G2: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2] 0.01 0 0 0.99 0.0001 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ Y1: chr [1:2] "Special" "Other"
##   .. .. ..$ X3: chr [1:2] "Special" "Other"
##   .. .. ..$ A : chr [1:2] "Suspect" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##  $ origCQpot    :List of 7
##   ..$ : parray [1:2, 1:2, 1:3] 0 0 0 0 0.00248 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ B: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:3] 0.5 0.5 0.5 0.5 0.25 0.75 0 1 0.5 0.5 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ A: chr [1:2] "Suspect" "Other"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. .. ..$ N: chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2] 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ W: chr [1:2] "Suspect_was_offender" "Suspect_not_offender"
##   .. .. ..$ C: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:3] 0.5 0.5 0.8 0.2 0.5 0.5
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ G1: chr [1:2] "Says_4" "Says_other"
##   .. .. ..$ N : chr [1:3] "Num_3" "Num_4" "Num_5"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2, 1:2, 1:2] 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00005 0.00495 0.00495 ...
##   .. ..- attr(*, "dimnames")=List of 5
##   .. .. ..$ Y2: chr [1:2] "Special" "Other"
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ X2: chr [1:2] "Special" "Other"
##   .. .. ..$ X1: chr [1:2] "Special" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2] 0.45 0.05 0.005 0.495 0.25 0.25 0.25 0.25
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ R : chr [1:2] "From_nose_punch" "Other"
##   .. .. ..$ B : chr [1:2] "Suspect" "Other"
##   .. .. ..$ G2: chr [1:2] "Yes" "No"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##   ..$ : parray [1:2, 1:2, 1:2] 0.01 0 0 0.99 0.0001 ...
##   .. ..- attr(*, "dimnames")=List of 3
##   .. .. ..$ Y1: chr [1:2] "Special" "Other"
##   .. .. ..$ X3: chr [1:2] "Special" "Other"
##   .. .. ..$ A : chr [1:2] "Suspect" "Other"
##   .. ..- attr(*, "class")= chr [1:2] "parray" "array"
##  $ details      : num 0
##  - attr(*, "class")= chr [1:2] "CPTgrain" "grain"