Degree
takes one or more graphs (dat
) and returns the degree centralities of positions (selected by nodes
) within the graphs indicated by g
. Depending on the specified mode, indegree, outdegree, or total (Freeman) degree will be returned; this function is compatible with centralization
, and will return the theoretical maximum absolute deviation (from maximum) conditional on size (which is used by centralization
to normalize the observed centralization score).
degree(dat, g=1, nodes=NULL, gmode="digraph", diag=FALSE, tmaxdev=FALSE, cmode="freeman", rescale=FALSE, ignore.eval=FALSE)
g
=1. "digraph"
indicates that edges should be interpreted as directed; "graph"
indicates that edges are undirected. gmode
is set to "digraph"
by default. diag
is FALSE
by default. tmaxdev==FALSE
. "indegree"
, "outdegree"
, and "freeman"
refer to the indegree, outdegree, and total (Freeman) degree measures, respectively. The default for cmode
is "freeman"
. When ignore.eval==FALSE
, degree
weights edges by their values where supplied. ignore.eval==TRUE
ensures an unweighted degree score (independent of input). Setting gmode=="graph"
forces behavior equivalent to cmode=="indegree"
(i.e., each edge is counted only once); to obtain a total degree score for an undirected graph in which both in- and out-neighborhoods are counted separately, simply use gmode=="digraph"
.
centralization
#Create a random directed graph
dat<-rgraph(10)
#Find the indegrees, outdegrees, and total degrees
degree(dat,cmode="indegree")
degree(dat,cmode="outdegree")
degree(dat)
Run the code above in your browser using DataLab