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

gden

Find the Density of a Graph


Description

gden computes the density of the graphs indicated by g in collection dat, adjusting for the type of graph in question.

Usage

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

Arguments

dat

one or more input graphs.

g

integer indicating the index of the graphs for which the density is to be calculated (or a vector thereof). 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.

ignore.eval

logical; should edge values be ignored when calculating 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 when ignore.eval==FALSE. The number of possible ties is determined by the graph type (and by diag) in the usual fashion.

Where missing data is present, it is removed prior to calculation. The density/graph mean is thus taken relative to the observed portion of the graph.

Value

The graph density

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

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

sna

Tools for Social Network Analysis

v2.6
GPL (>= 2)
Authors
Carter T. Butts [aut, cre, cph]
Initial release
2020-10-5

We don't support your browser anymore

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