Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gvectorize

Vectorization of Adjacency Matrices


Description

gvectorize takes an input graph set and converts it into a corresponding number of vectors by row concatenation.

Usage

gvectorize(mats, mode="digraph", diag=FALSE, censor.as.na=TRUE)

Arguments

mats

one or more input graphs.

mode

“digraph” if data is taken to be directed, else “graph”.

diag

boolean indicating whether diagonal entries (loops) are taken to contain meaningful data.

censor.as.na

if TRUE, code unused parts of the adjacency matrix as NAs prior to vectorizing; otherwise, unused parts are simply removed.

Details

The output of gvectorize is a matrix in which each column corresponds to an input graph, and each row corresponds to an edge. The columns of the output matrix are formed by simple row-concatenation of the original adjacency matrices, possibly after removing cells which are not meaningful (if censor.as.na==FALSE). This is useful when preprocessing edge sets for use with glm or the like.

Value

An nxk matrix, where n is the number of arcs and k is the number of graphs; if censor.as.na==FALSE, n will be reflect the relevant number of uncensored arcs.

Author(s)

Carter T. Butts buttsc@uci.edu

Examples

#Draw two random graphs
g<-rgraph(10,2)

#Examine the vectorized form of the adjacency structure
gvectorize(g)

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.