degree: Compute the Degree Centrality Scores of Network Positions

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/nli.R


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)



one or more input graphs.


integer indicating the index of the graph for which centralities are to be calculated (or a vector thereof). By default, g=1.


vector indicating which nodes are to be included in the calculation. By default, all nodes are included.


string indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected. gmode is set to "digraph" by default.


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.


boolean indicating whether or not the theoretical maximum absolute deviation from the maximum nodal centrality should be returned. By default, tmaxdev==FALSE.


string indicating the type of degree centrality being computed. "indegree", "outdegree", and "freeman" refer to the indegree, outdegree, and total (Freeman) degree measures, respectively. The default for cmode is "freeman".


if true, centrality scores are rescaled such that they sum to 1.


logical; should edge values be ignored when computing degree scores?


Degree centrality is the social networker's term for various permutations of the graph theoretic notion of vertex degree: for unvalued graphs, indegree of a vertex, v, corresponds to the cardinality of the vertex set N^+(v) = {i in V(G) : (i,v) in E(G)}; outdegree corresponds to the cardinality of the vertex set N^-(v) = {i in V(G) : (v,i) in E(G)}; and total (or “Freeman”) degree corresponds to |N^+(v)|+|N^-(v)|. (Note that, for simple graphs, indegree=outdegree=total degree/2.) Obviously, degree centrality can be interpreted in terms of the sizes of actors' neighborhoods within the larger structure. See the references below for more details.

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


A vector, matrix, or list containing the degree scores (depending on the number and size of the input graphs).


Carter T. Butts [email protected]


Freeman, L.C. (1979). “Centrality in Social Networks I: Conceptual Clarification.” Social Networks, 1, 215-239.

See Also



#Create a random directed graph
#Find the indegrees, outdegrees, and total degrees

Example output

Loading required package: statnet.common
Loading required package: network
network: Classes for Relational Data
Version 1.13.0 created on 2015-08-31.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
                    Mark S. Handcock, University of California -- Los Angeles
                    David R. Hunter, Penn State University
                    Martina Morris, University of Washington
                    Skye Bender-deMoll, University of Washington
 For citation information, type citation("network").
 Type help("network-package") to get started.

sna: Tools for Social Network Analysis
Version 2.4 created on 2016-07-23.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
 For citation information, type citation("sna").
 Type help(package="sna") to get started.

 [1] 5 4 6 2 7 3 3 5 5 5
 [1] 2 4 5 6 4 8 2 6 3 5
 [1]  7  8 11  8 11 11  5 11  8 10

sna documentation built on May 30, 2017, 12:18 a.m.

Related to degree in sna...