sum.network: Combine Networks by Edge Value Addition

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

Description

Given a series of networks, sum.network attempts to form a new network by accumulation of edges. If a non-null attrname is given, the corresponding edge attribute is used to determine and store edge values.

Usage

1
2
## S3 method for class 'network'
sum(..., attrname = NULL, na.rm = FALSE)

Arguments

...

one or more network objects.

attrname

the name of an edge attribute to use when assessing edge values, if desired.

na.rm

logical; should edges with missing data be ignored?

Details

The network summation method attempts to combine its arguments by addition of their respective adjacency matrices; thus, this method is only applicable for networks whose adjacency coercion is well-behaved. Addition is effectively boolean unless attrname is specified, in which case this is used to assess edge values – net values of 0 will result in removal of the underlying edge.

Other network attributes in the return value are carried over from the first element in the list, so some persistence is possible (unlike the addition operator). Note that it is sometimes possible to “add” networks and raw adjacency matrices using this routine (if all dimensions are correct), but more exotic combinations may result in regrettably exciting behavior.

Value

A network object.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). http://www.jstatsoft.org/v24/i02/

See Also

network.operators

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#Create some networks
g<-network.initialize(5)
h<-network.initialize(5)
i<-network.initialize(5)
g[1,,names.eval="marsupial",add.edges=TRUE]<-1
h[1:2,,names.eval="marsupial",add.edges=TRUE]<-2
i[1:3,,names.eval="marsupial",add.edges=TRUE]<-3

#Combine by addition
pouch<-sum(g,h,i,attrname="marsupial")
pouch[,]                                   #Edge values in the pouch?
as.sociomatrix(pouch,attrname="marsupial")     #Recover the marsupial

Example output

network: Classes for Relational Data
Version 1.16.1 created on 2020-10-06.
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.

  1 2 3 4 5
1 1 1 1 1 1
2 1 1 1 1 1
3 1 1 1 1 1
4 0 0 0 0 0
5 0 0 0 0 0
  1 2 3 4 5
1 6 6 6 6 6
2 5 5 5 5 5
3 3 3 3 3 3
4 0 0 0 0 0
5 0 0 0 0 0

network documentation built on May 2, 2019, 5:16 p.m.