A note on (matricial and fast) ways to compute Burt's structural holes
AA note on (matricial and fast) ways tocompute Burt’s structural holes ∗ Alessio MuscilloDepartment of Economics and Statistics, Universit`a di Siena, ItalyFebruary 19, 2021
Abstract
In this note I derive simple formulas based on the adjacency matrix ofa network to compute measures associated with Burt’s structural holes(effective size, local constraint and constraint). This not only can help tointerpret these measures, but also the computational advantage is enor-mous when analyzing real-world networks, often characterized by largeand sparse adjacency matrices: instead of looping over nodes, one canrely on very efficient and fast matrix operations (e.g., multiplication).
Keywords : network measures, structural holes, effective size, constraint,computation
JEL classification : C63 (Computational Techniques - Simulation Mod-eling), L14 (Transactional Relationships - Contracts and Reputation -Networks)
Burt’s structural holes is a pervasive and fascinating notion used when analyzingsocial networks [Burt(1995), Burt(2004)]. Intuitively, it captures the idea thatsome individuals’ position in a social network can limit their interactions andcommunications with others. Bridging gaps and understanding how to takeadvantage from these limitations can be a source of opportunities and be verybeneficial for individuals able to do so.One the one hand, the versatility of this concept has stimulated the definitionof several measures, each capturing a different aspect. On the other hand, this ∗ email: [email protected] author acknowledges funding from the Italian Ministry of Education Progetti di RilevanteInteresse Nazionale (PRIN) grants 2015592CTH and 2017ELHNNJ.The author thanks Tiziano Razzolini for his support. Additional material and Python codeused in this note are available online here. a r X i v : . [ c s . S I] F e b as also generated confusion when it comes to which exact measure one has tocompute and how to compute it [Borgatti(1997), Everett and Borgatti(2020)].On top of this, computing these measures by applying the definition formulascan be very slow and computationally intensive when the network to analyze islarge, because it requires looping over every node’s neighbors (and its neighbors’neighbors).In this note, I consider some measures associated with Burt’s structuralholes, namely effective size, local constraint and constraint, and I derive simpleformulas for them based on the adjacency matrix of the network. This can notonly help interpreting these measures but it also gives a great computationaladvantage, resulting in algorithms that are several orders of magnitude fasterthan those implemented in some package for network analysis (see Figure 1).The intuition is that instead of looping over nodes, one uses the adjacencymatrix and rely on matrix multiplications among sparse matrices (which arevery efficient operations when performed on large sparse matrices, typical ofreal-world social networks). Computational speed t i m e ( s e c o n d s ) Effective size nxalgorithm 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000number of nodes10 t i m e ( s e c o n d s ) Constraint nxalgorithm1000 2000 3000 4000 5000 6000 7000 8000 9000 10000number of nodes10 t i m e ( s e c o n d s ) Effective size nxalgorithm 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000number of nodes10 t i m e ( s e c o n d s ) Constraint nxalgorithm
Figure 1:
Comparison of computational speed between the author’s algorithms (or-ange) and NetworkX’s algorithms (blue) for effective size (left) and constraint (right),as the number of nodes increases from 1,000 to 10,000. The networks are Barabasi-Albert graphs with parameter m = 5 (top row) and Erdos-Renyi random graphs withparameter p = 0 .
01 (bottom row). The scale on the y-axis (time) is logarithmic,showing that the author’s algorithms are several orders of magnitude faster. Notation
In what follows, matrices are denoted by capital letters (e.g. A , P ) and theirelements denoted by the corresponding letter with subscripts (e.g. a ij , p ij ).Generic nodes of a network will be indicated by i , j or k . Consequently, anadjacency matrix will be indicated by A = ( a ij ) i,j =1 ,...,n , where n is the numberof nodes.Vectors and their elements will be respectively denoted by bold letters (e.g. x , y ) and letters with a (single) subscript (e.g. x i ). The vector obtained bytaking the diagonal elements of a square matrix A is denoted by Diag ( A ) and,analogously, the matrix that has x as its diagonal and 0s elsewhere is denotedby Diag ( x ). The transposed of a vector or matrix is denoted by · T (e.g. x T , A T ). Hereafter, vectors are considered as columns, that is ( n × x T . Accordingly, the (matrix) multiplication ofa column vector x times a row vector y T will give a matrix (e.g. xy T ∈ R n × n )whereas x T y a scalar.The matrix multiplication between two matrices A and B will be denoted byjuxtaposition, i.e. AB , whereas element-by-element operations such as element-wise multiplication or division will be denoted respectively by (cid:12) and (cid:11) . The n -dimensional unitary vectors in R n containing all 0s but one 1 in i -th positionis denoted by e i , while the vector containing all 1s is denoted by . The identitymatrix is denoted by I . Consider an undirected and binary network with no self-loops. According to[Borgatti(1997)] , the effective size of n ode i for such a network is given by: d i − t i d i (1)where d i is i ’s degree and t i is “the number of ties in the network (not includingties to ego)”. The intuitive idea (see Figure 2) is first to compute a node’s redundancy , which counts the number of common neighbors between ego andeach one of its alters. Then, the effective size is obtained by subtracting theredundancy to the ego’s degree.Now, let us see how to compute this in a matricial form. Let A = ( a ij ) i,j bethe adjacency matrix of such an undirected and binary network and let d = ( d i ) i be the vector of nodes’ degrees. Notice that for a binary network, the elementsof the square A count the number of common neighbors. Indeed, for every two ibid. Note: “ego” here is node i . A is a symmetric matrix only containing 0s and 1s. In such a case the vector of nodes’degree can be obtained in several ways, for example as d = Diag ( A ) or d = A . omputation of effective size Figure 2:
Adapted from Burt’s and Borgatti’s works. Let us compute the effective sizefor node A . Consider one of its neighbors, say G . They have 3 “common neighbors”: B , E and F . Divide this number by A ’s degree: 3 /
4. Take another of A ’s neighbors,say E . A and E have just 1 common neighbor, which is G . So, in this case dividing by A ’s degree gives 1 /
4. To get A ’s redundancy , repeat this process for all 4 neighbors of A (respectively, B , E , F and G ) and sum up all the numbers obtained: + + + = = 1 .
5. Lastly, A ’s effective size is its degree minus its redundancy: 4 − . .
5. Inthe example of this section, the matricial computation is also done for the remainingnodes. nodes i and j , the ( i, j )-th element of A is:( A ) ij = n (cid:88) k =1 a ik a kj = |{ k : k ∈ N ( i ) and k ∈ N ( j ) }| = number of common neighbors of i and j, (2)since a ik is different from 0 if and only if i and k are linked and, analogously, a kj is different from 0 if and only if k and j are linked. Obviously, we only wantto count the common neighbors for pairs of nodes that are actually linked inthe network. To do so, it suffices to multiply A element by element for A itself.Lastly, we want to sum all these numbers and divide them by the correspondingdegree.Summing up, a matricial way to compute the vector of nodes’ effective sizeis by computing the following vector: x eff. size = d − ( A (cid:12) A ) (cid:11) d , (3)where A is A squared with the standard matrix multiplication. The i -th com-ponent of such a vector is node i ’s effective size. By definition the redundancyis just the last term, that is ( A (cid:12) A ) (cid:11) d .4 xample Consider the network in Figure 2. The adjacency matrix and thedegree vector are, respectively A = . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 1 1 1 1 1 . , d = . Now, since A = , then equation (3) gives the effective size for each node:nodes ABCDEFG → . . . . Let A = ( a ij ) i,j be the adjacency matrix of a network (not necessarily binary orunweighted). Following [Everett and Borgatti(2020)] again, the local constraint on i with respect to j , denoted (cid:96) ij , is defined by (cid:96) ij = p ij + (cid:88) k ∈ N ( i ) \{ j } p ik p kj , (4) For simplicity, in A the 0s are not indicated. Notice that self loops are not allowed. That is, A is not necessarily symmetric and may contains elements different from 0 or 1.The only assumption here is that no self-loop is allowed, that is, a ii = 0 for all nodes i . This is also known as dyadic constraint . The definition used in NetworkX’s algorithm forlocal constraint is slightly different. The only modification consists in changing k ∈ N ( i ) \ { j } with k ∈ N ( j ). I discuss how to adapt the matricial algorithm in the additional materialavailable at the link in the first acknowledgements note. N ( i ) is the set of neighbors of i and p ij is the normalized mutual weight of the edges joining i and j , that is, p ij = a ij + a ji (cid:80) k ( a ik + a ki ) . (5)Notice that assuming absence of self-loops then every p ii = 0 because a ii = 0.This implies that the second term in definition (4) can be written as (cid:88) k ∈ N ( i ) \{ j } p ik p kj = (cid:88) k ∈ N ( i ) p ik p kj − p ij p jj (cid:124)(cid:123)(cid:122)(cid:125) =0 = (cid:88) k ∈ N ( i ) p ik p kj , (6)and, hence, (cid:96) ij becomes (cid:96) ij = p ij + (cid:88) k ∈ N ( i ) p ik p kj . (7)Now, let us focus on p ij , writing equation (5) in matricial terms: p ij = ( A + A T ) ij · A T + A ) e i ) T , (8)and let us define vector x = ( x i ) i , where x i = ( A + A T ) e Ti = (cid:88) k ( a ik + a ki ) , (9)Thus x = ( A + A T ) T = ( A T + A ) (10)and we can consider the vector containing all inverted elements: y = (cid:11) x = /x ...1 /x n . (11)Then, define the matrix which only consists on the diagonal being equal to y ,that is, Diag ( y ). Now, we can finally compute P = ( p ij ) i,j as follows: P = Diag ( y ) ( A + A T ) . (12)Now, let us focus on (cid:96) ij . Consider again the second term of the definition’sformula as written in equation (7) (cid:88) k ∈ N ( i ) p ik p kj = (cid:88) k a ik p ik p kj , (13) Notice that the denominator here is the multiplication of a row vector times a columnvector, which is a number. Notice that A T + A is always symmetric, even if A is not. By pre-multiplying a diagonal matrix, we are just multiplying every row i of ( A + A T )for the corresponding element y i of the diagonal. k (not just limitedto i ’s neighbors). Written in matricial form, this summation in equation (13)can simply be expressed as ( A (cid:12) P ) P, (14)where (cid:12) is the element-wise matricial multiplication and the second is a matrixmultiplication.To conclude, we can write the matrix L = ( (cid:96) ij ) i,j containing all links’ localconstraints as follows: L = (cid:2) P + ( A (cid:12) P ) P (cid:3) (cid:12) (cid:2) P + ( A (cid:12) P ) P (cid:3) . (15)Summing up, the algorithm takes the adjacency matrix A as input and proceedswith the following steps:1. x = ( A + A T ) ;2. y = (cid:11) x ;3. P = Diag ( y ) ( A + A T );4. L = (cid:2) P + ( A (cid:12) P ) P (cid:3) (cid:12) (cid:2) P + ( A (cid:12) P ) P (cid:3) . Let L = ( (cid:96) ij ) i,j be the local constraint matrix computed in equation (15).According to [Everett and Borgatti(2020)], the constraint for node i is c i = (cid:88) j ∈ N ( i ) (cid:96) ij . One can re-write this as follows: c i = (cid:88) j (cid:96) ij a ij , where ( a ij ) i,j = A is the adjacency matrix. So, the vector c = ( c i ) i containingthe constraints of the network is obtained by summing the rows of the matrix L (cid:12) A : c = (cid:2) T ( L (cid:12) A ) (cid:3) T . If the network is weighted, then here one has to first compute the binary version A ofthe weighted adjacency matrix W , where a ij = 1 if and only if w ij (cid:54) = 0 and a ij = 0 otherwise.Then, one can just apply the formula written in the text. The modification mentioned in Footnote 5 consists in taking here P ( P (cid:12) A ). Notice that in our notation N ( i ) does not include i itself. To be even more clear, onecould then write c i = (cid:80) j ∈ N ( i ) \{ i } (cid:96) ij . In case the network is weighted, then here the matrix A is the binary version of theweighted adjacency matrix W , as observed in Footnote 9. Remember that in our notation vectors are always considered as columns. eferences [Borgatti(1997)] Borgatti, S. P. (1997). Structural holes: Unpacking Burt’sredundancy measures.
Connections , (1), 35–38.[Burt(1995)] Burt, R. S. (1995).
Structural Holes . Harvard University Press.[Burt(2004)] — (2004). Structural holes and good ideas. American journal ofsociology , (2), 349–399.[Everett and Borgatti(2020)] Everett, M. G. and
Borgatti, S. P. (2020).Unpacking Burt’s constraint measure.
Social Networks ,62