Learn R Programming

network (version 1.0-1)

network.dyadcount: Return the Number of Edges in a Network Object

Description

network.dyadcount returns the number of dyads within a network, removing those flagged as missing if desired.

Usage

network.dyadcount(x, na.omit = TRUE)

Arguments

x
an object of class network
na.omit
logical; omit edges with na==TRUE from the count?

Value

  • The number of dyads in the network

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

References

Butts, C.T. 2002. ``Memory Structures for Relational Data in R: Classes and Interfaces'' Working Paper.

See Also

get.network.attribute

Examples

Run this code
#Create a 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 dyad count
g<-network(m|t(m),directed=FALSE)
network.dyadcount(g)==3                         #nC2 in undirected case

Run the code above in your browser using DataLab