symmetrize: Symmetrize an Adjacency Matrix

Description Usage Arguments Details Value Author(s) References Examples

View source: R/dataprep.R

Description

Symmetrizes the elements of mats according to the rule in rule.

Usage

1
symmetrize(mats, rule="weak", return.as.edgelist=FALSE)

Arguments

mats

a graph or graph stack.

rule

one of “upper”, “lower”, “strong” or “weak”.

return.as.edgelist

logical; should the symmetrized graphs be returned in edgelist form?

Details

The rules used by symmetrize are as follows:

  1. upper: Copy the upper triangle over the lower triangle

  2. lower: Copy the lower triangle over the upper triangle

  3. strong: i<->j iff i->j and i<-j (AND rule)

  4. weak: i<->j iff i->j or i<-j (OR rule)

Value

The symmetrized graph stack

Author(s)

Carter T. Butts buttsc@uci.edu

References

Wasserman, S., and Faust, K. (1994). Social Network Analysis: Methods and Applications. Cambridge: Cambridge University Press.

Examples

1
2
3
4
5
6
7
8
#Generate a graph
g<-rgraph(5)

#Weak symmetrization
symmetrize(g)

#Strong symmetrization
symmetrize(g,rule="strong")

Example output

Loading required package: statnet.common
Loading required package: network
network: Classes for Relational Data
Version 1.13.0 created on 2015-08-31.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
                    Mark S. Handcock, University of California -- Los Angeles
                    David R. Hunter, Penn State University
                    Martina Morris, University of Washington
                    Skye Bender-deMoll, University of Washington
 For citation information, type citation("network").
 Type help("network-package") to get started.

sna: Tools for Social Network Analysis
Version 2.4 created on 2016-07-23.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
 For citation information, type citation("sna").
 Type help(package="sna") to get started.

     [,1] [,2] [,3] [,4] [,5]
[1,]    0    1    0    1    0
[2,]    1    0    1    1    1
[3,]    0    1    0    1    0
[4,]    1    1    1    0    0
[5,]    0    1    0    0    0
     [,1] [,2] [,3] [,4] [,5]
[1,]    0    1    0    0    0
[2,]    1    0    0    0    0
[3,]    0    0    0    0    0
[4,]    0    0    0    0    0
[5,]    0    0    0    0    0

sna documentation built on May 30, 2017, 12:18 a.m.

Search within the sna package
Search all R packages, documentation and source code