Learn R Programming

sna (version 2.4)

gcov: Find the Covariance(s) Between Two or More Labeled Graphs

Description

gcov finds the covariances between the adjacency matrices of graphs indicated by g1 and g2 in stack dat (or possibly dat2). Missing values are permitted.

Usage

gcov(dat, dat2=NULL, g1=NULL, g2=NULL, diag=FALSE, mode="digraph")

Arguments

dat

one or more input graphs.

dat2

optionally, a second graph stack.

g1

the indices of dat reflecting the first set of graphs to be compared; by default, all members of dat are included.

g2

the indices or dat (or dat2, if applicable) reflecting the second set of graphs to be compared; by default, all members of dat are included.

diag

boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. diag is FALSE by default.

mode

string indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. mode is set to "digraph" by default.

Value

A graph covariance matrix

Details

The graph covariance between two labeled graphs is defined as $$cov(G,H) = \frac{1}{{|V| \choose 2}} \sum_{\{i,j\}} \left(A^G_{ij}-\mu_G\right)\left(A^H_{ij}-\mu_H\right)$$ (with \(A^G\) being the adjacency matrix of G). The graph correlation/covariance is at the center of a number of graph comparison methods, including network variants of regression analysis, PCA, CCA, and the like.

Note that gcov computes only the covariance between uniquely labeled graphs. For the more general case, gscov is recommended.

References

Butts, C.T., and Carley, K.M. (2001). ``Multivariate Methods for Interstructural Analysis.'' CASOS Working Paper, Carnegie Mellon University.

See Also

gscov, gcor, gscor

Examples

Run this code
# NOT RUN {
#Generate two random graphs each of low, medium, and high density
g<-rgraph(10,6,tprob=c(0.2,0.2,0.5,0.5,0.8,0.8))

#Examine the covariance matrix
gcov(g)
# }

Run the code above in your browser using DataLab