convertGraph: Convert graphs into adjacency matrices

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/convertGraph.R

Description

Convert into adjacency matrices NG graphs (expressed as lists of connected nodes)

Usage

1
convertGraph(Graph)

Arguments

Graph

array of dimension p x Dmax x NG, where Dmax is the degree of the graph and NG the number of graphs. If NG is equal to 1, Graph can be a matrix of dimension p x Dmax.

Graph[a,,iG] should be the indices of the nodes connected to the node a, for the graph iG;
Graph[a,1,iG] should be equal to 0 if there is no node connected to the node a.

Value

An array of dimension p x p x NG, or, when NG is equal to 1, a matrix of dimension p x p.

The entry [,,iG] is a symmetric matrix, with diagonal equal to zero. The entry [a,b,iG] is equal to 1 if a is connected to b, 0 otherwise.

Note

This function is useful to generate the entry MyFamily of the function selectMyFam. Actually, the list of adjacency matrices MyFamily can be generated from lists of connected nodes with convertGraph.

Author(s)

Bouvier A, Giraud C, Huet S, Verzelen N

References

Please use citation("GGMselect")

See Also

selectQE, selectMyFam, selectFast, simulateGraph, penalty

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
p=30
n=30
# simulate graph
eta=0.11
Gr <- simulateGraph(p,eta)
X <- rmvnorm(n, mean=rep(0,p), sigma=Gr$C)
# estimate graph
GRest <- selectFast(X, family="C01")
# Neighb and G are 2 forms of the same result
a <- convertGraph(GRest$C01$Neighb)
print(all.equal(a, GRest$C01$G)) # TRUE
# recalculate the graph with selectMyFam
GMF <- selectMyFam(X, list(a))
print(all.equal(a,GMF$G)) # TRUE

Example output

Loading required package: mvtnorm
Loaded GGMselect 0.1.12

[1] TRUE
[1] TRUE

GGMselect documentation built on Jan. 10, 2020, 9:07 a.m.