s_metric

Contents

s_metric#

graph_tool.structure.s_metric(g)[git][source]#

Return the s-metric of the graph.

Parameters:
gGraph

Graph to be used.

Returns:
sfloat

The sum of \(k_uk_v\) over the edges \((u, v)\), where \(k\) is the total degree.

See also

graph_tool.correlations.assortativity

Degree assortativity coefficient

graph_tool.correlations.scalar_assortativity

Scalar assortativity

Notes

The s-metric [li-towards-2005] is defined as

\[s(G) = \sum_{(u,v)\in E} k_uk_v,\]

where \(k_u\) is the total degree of vertex \(u\) (the sum of its in- and out-degrees, for directed graphs), with parallel edges counted with their multiplicity and a self-loop contributing two, as in the handshake lemma. Every edge, including each parallel edge and self-loop, appears once in the sum, so that a self-loop at \(u\) contributes \(k_u^2\). It is large for graphs whose high-degree vertices are connected to each other, and is related to the degree assortativity (see assortativity()). The time is \(O(V + E)\).

References

[li-towards-2005]

Lun Li, David Alderson, John C. Doyle and Walter Willinger, “Towards a theory of scale-free graphs: definition, properties, and implications”, Internet Mathematics 2, 431-523 (2005), DOI: 10.1080/15427951.2005.10129111 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.s_metric(g))
3640.0