burt_constraint#
- graph_tool.centrality.burt_constraint(g, weight=None, vprop=None)[git][source]#
Compute Burt’s constraint of the vertices.
- Parameters:
- g
Graph Graph to be used.
- weight
EdgePropertyMap(optional, default:None) Edge weights. If not supplied, every edge has unit weight.
- vprop
VertexPropertyMap(optional, default:None) Vertex property map of type
doubleto store the values.
- g
- Returns:
- constraint
VertexPropertyMap Vertex property map with the constraint values (
nanfor vertices without neighbors).
- constraint
See also
burt_effective_sizeEffective size of the ego networks
diversityEntropy of the edge weights of each vertex
graph_tool.clustering.local_clusteringLocal clustering coefficient
Notes
The constraint [burt-structural-1992] measures how much the contacts of a vertex are connected to each other, and hence how little the vertex bridges structural holes,
\[c_i = \sum_{j} \Big(p_{ij} + \sum_{q\ne i,j}p_{iq}p_{qj}\Big)^2, \quad p_{ij} = \frac{a_{ij}+a_{ji}}{\sum_k (a_{ik}+a_{ki})},\]where the sums run over the neighbors (in either direction), \(a_{ij}\) is the total weight of the edges from \(i\) to \(j\), and self-loops are ignored. It takes time \(O(\sum_i k_i^2)\).
Parallel implementation.
If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.
References
[burt-structural-1992]Ronald S. Burt, “Structural Holes: The Social Structure of Competition”, Harvard University Press (1992).
Examples
>>> g = gt.collection.data["karate"] >>> c = gt.burt_constraint(g) >>> print(c.a.argmin(), c.a.min()) 0 0.155423297...
The values can be visualized by drawing the network with vertex colors and sizes given by them:
>>> cmap = matplotlib.colors.LinearSegmentedColormap.from_list( ... "gray-blue", ["#d9d9d9", "#7dabd1"]) >>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=c, vcmap=cmap, ... vertex_size=gt.prop_to_size(c, mi=5, ma=15), ... output="burt_constraint-karate.pdf") <...>
Burt’s constraint of the vertices of Zachary’s karate club network. The vertex colors, from gray to blue, and the vertex sizes increase with the value.#