Learn R Programming

sna (version 0.41)

gden: Find the Density of a Graph

Description

gden computes the density of graph g in stack dat, adjusting for the type of graph in question.

Usage

gden(dat, g=NULL, diag=FALSE, mode="digraph")

Arguments

dat
Data array to be analyzed. By assumption, the first dimension of the array indexes the graph, with the next two indexing the actors. If dat is a matrix, g will be ignored.
g
Integer indicating the index of the graphs for which the density is to be calculated. If g==NULL (the default), density is calculated for all graphs in dat.
diag
Boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. diag is FALSE by default.
mode
String indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. mode is set to "digraph" by default.

Value

  • The graph density

Details

The density of a graph is here taken to be the sum of tie values divided by the number of possible ties (i.e., an unbiased estimator of the graph mean); hence, the result is interpretable for valued graphs as the mean tie value. The number of possible ties is determined by the graph type (and by diag) in the usual fashion.

References

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

Examples

Run this code
#Draw three random graphs
dat<-rgraph(10,3)
#Find their densities
gden(dat)

Run the code above in your browser using DataLab