liveBook · Manning

Power law distribution

As explained in Graph Algorithms for Data Science

A power-law distribution is a probability distribution in which relatively few values are very large and many values are small, following an inverse-power relationship.

A power-law distribution describes a network where many nodes have small degree values and relatively few nodes have very large values. In a directed network, inspect incoming and outgoing connections separately. section 5.1.1

A degree distribution becomes useful when its summary statistics are read alongside a visualization:

  • The Twitter subgraph has an average out-degree of about 7, but a median of 2; half of the nodes have two or fewer outgoing connections. section 5.1.1
  • More than 1,000 nodes have zero outgoing connections, most have fewer than 10 links, and the maximum out-degree is 143. section 5.1.1
  • Incoming connections show the same unequal shape: more than half of the users have no incoming connections, while one user has 540. section 5.1.1

Measure an out-degree distribution

Use Neo4j and APOC to count each user's outgoing FOLLOWS relationships, then return aggregate statistics. Compare the mean, median, percentiles, and maximum to reveal whether a small number of nodes account for unusually many links. section 5.1.1

Listing 5.1 Evaluating the node out-degree distribution with the apoc.agg.statistics function
MATCH (u:User)
WITH u, count{ (u)-[:FOLLOWS]->() } AS outDegree
RETURN apoc.agg.statistics(outDegree)

Runs the out-degree measurement query for every User node and returns statistics for the resulting distribution. section 5.1.1

How Graph Algorithms for Data Science covers it

How deep it goes
Defines the pattern and demonstrates degree statistics and histograms, but stops short of formal mathematical derivation.
Examples
Uses a Twitter followers network, Neo4j degree queries, APOC statistics, seaborn histograms, and highly followed users.
What it assumes
Assumes familiarity with nodes, relationships, and directed connections while teaching in-degree and out-degree distinctions.
What you can do after
Diagnose degree imbalance by querying in-degree or out-degree and comparing averages, percentiles, maxima, and histograms.
How it connects
Connects power-law distribution with node degree, in-degree, out-degree, directed networks, histograms, and social network analysis.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.