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

network.dyadcount

Return the Number of (Possibly Directed) Dyads in a Network Object


Description

network.dyadcount returns the number of possible dyads within a network, removing those flagged as missing if desired. If the network is directed, directed dyads are counted accordingly.

Usage

## S3 method for class 'network'
network.dyadcount(x, na.omit = TRUE, ...)

Arguments

x

an object of class network

na.omit

logical; omit edges with na==TRUE from the count?

...

possible additional arguments, used by other implementations

Details

The return value network.dyadcount is equal to the number of dyads, minus the number of NULL edges (and missing edges, if na.omit==TRUE). If x is directed, the number of directed dyads is returned. If the network allows loops, the number of possible entries on the diagnonal is added. Allthough the function does not give an error on multiplex networks or hypergraphs, the results probably don't make sense.

Value

The number of dyads in the network

Author(s)

Mark S. Handcock handcock@stat.washington.edu, skyebend

References

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

See Also

Examples

#Create a directed network with three edges
m<-matrix(0,3,3)
m[1,2]<-1; m[2,3]<-1; m[3,1]<-1
g<-network(m)
network.dyadcount(g)==6                 #Verify the directed dyad count
g<-network(m|t(m),directed=FALSE)
network.dyadcount(g)==3                         #nC2 in undirected case

network

Classes for Relational Data

v1.16.1
GPL (>= 2)
Authors
Carter T. Butts [aut, cre], David Hunter [ctb], Mark Handcock [ctb], Skye Bender-deMoll [ctb], Jeffrey Horner [ctb], Li Wang [ctb]
Initial release
2020-10-06

We don't support your browser anymore

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