Null models

Edge weights can be adjusted to identify particularly significant edges using a null model. Null models are sets of assumptions that are used to predict the strength of an edge, which can be used to identify edges that surpass those predictions. This might seem familiar because the gravity model that we used in the previous chapter is an example of a null model. Here, we will use a simpler model , assuming that the weight of an edge is proportional to the product of the degrees of the endpoints. The following function takes a Graph as input and produces a new copy with a log_residual edge property representing the deviation of each edge from its predicted weight:

import mathdef residual_net(G):    G_residual = nx.Graph(G) # Calculate ...

Get Network Science with Python and NetworkX Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.