`gscov`

finds the structural covariance between the adjacency matrices of graphs indicated by `g1`

and `g2`

in stack `dat`

(or possibly `dat2`

) given exchangeability list `exchange.list`

. Missing values are permitted.

1 2 3 |

`dat` |
one or more input graphs. |

`dat2` |
optionally, a second graph stack. |

`g1` |
the indices of |

`g2` |
the indices or |

`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. |

`mode` |
string indicating the type of graph being evaluated. |

`method` |
method to be used to search the space of accessible permutations; must be one of |

`reps` |
number of iterations for Monte Carlo method. |

`prob.init` |
initial acceptance probability for the annealing routine. |

`prob.decay` |
cooling multiplier for the annealing routine. |

`freeze.time` |
freeze time for the annealing routine. |

`full.neighborhood` |
dhould the annealer evaluate the full neighborhood of pair exchanges at each iteration? |

`exchange.list` |
information on which vertices are exchangeable (see below); this must be a single number, a vector of length n, or a nx2 matrix. |

The structural covariance between two graphs G and H is defined as

*
scov(G,H | L_G,L_H) = max_[L_G,L_H] cov(l(G),l(H))*

where *L_G* is the set of accessible permutations/labelings of G, *l(G)* is a permutation/labeling of G, and *l(G) in L_G*. The set of accessible permutations on a given graph is determined by the *theoretical exchangeability* of its vertices; in a nutshell, two vertices are considered to be theoretically exchangeable for a given problem if all predictions under the conditioning theory are invariant to a relabeling of the vertices in question (see Butts and Carley (2001) for a more formal exposition). Where no vertices are exchangeable, the structural covariance becomes the simple graph covariance. Where *all* vertices are exchangeable, the structural covariance reflects the covariance between unlabeled graphs; other cases correspond to covariance under partial labeling.

The accessible permutation set is determined by the `exchange.list`

argument, which is dealt with in the following manner. First, `exchange.list`

is expanded to fill an nx2 matrix. If `exchange.list`

is a single number, this is trivially accomplished by replication; if `exchange.list`

is a vector of length n, the matrix is formed by cbinding two copies together. If `exchange.list`

is already an nx2 matrix, it is left as-is. Once the nx2 exchangeabiliy matrix has been formed, it is interpreted as follows: columns refer to graphs 1 and 2, respectively; rows refer to their corresponding vertices in the original adjacency matrices; and vertices are taken to be theoretically exchangeable iff their corresponding exchangeability matrix values are identical. To obtain an unlabeled graph covariance (the default), then, one could simply let `exchange.list`

equal any single number. To obtain the standard graph covariance, one would use the vector `1:n`

.

Because the set of accessible permutations is, in general, very large (*o(n!)*), searching the set for the maximum covariance is a non-trivial affair. Currently supported methods for estimating the structural covariance are hill climbing, simulated annealing, blind monte carlo search, or exhaustive search (it is also possible to turn off searching entirely). Exhaustive search is not recommended for graphs larger than size 8 or so, and even this may take days; still, this is a valid alternative for small graphs. Blind monte carlo search and hill climbing tend to be suboptimal for this problem and are not, in general recommended, but they are available if desired. The preferred (and default) option for permutation search is simulated annealing, which seems to work well on this problem (though some tinkering with the annealing parameters may be needed in order to get optimal performance). See the help for `lab.optimize`

for more information regarding these options.

Structural covariance matrices are p.s.d., and are p.d. so long as no graph within the set is a linear combination of any other under any accessible permutation. Their eigendecompositions are meaningful and they may be used in linear subspace analyses, so long as the researcher is careful to interpret the results in terms of the appropriate set of accessible labelings. Classical null hypothesis tests should not be employed with structural covariances, and QAP tests are almost never appropriate (save in the uniquely labeled case). See `cugtest`

for a more reasonable alternative.

An estimate of the structural covariance matrix

The search process can be *very slow*, particularly for large graphs. In particular, the *exhaustive* method is order factorial, and will take approximately forever for unlabeled graphs of size greater than about 7-9.

Consult Butts and Carley (2001) for advice and examples on theoretical exchangeability.

Carter T. Butts buttsc@uci.edu

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
#Generate two random graphs
g.1<-rgraph(5)
g.2<-rgraph(5)
#Copy one of the graphs and permute it
perm<-sample(1:5)
g.3<-g.2[perm,perm]
#What are the structural covariances between the labeled graphs?
gscov(g.1,g.2,exchange.list=1:5)
gscov(g.1,g.3,exchange.list=1:5)
gscov(g.2,g.3,exchange.list=1:5)
#What are the structural covariances between the underlying
#unlabeled graphs?
gscov(g.1,g.2)
gscov(g.1,g.3)
gscov(g.2,g.3)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.