liveBook · Manning

Node degree

As explained in Graph Neural Networks in Action

The degree of a node is the number of graph edges incident to it, subject to conventions such as self-loop counting.

Node degree counts the edges incident to a node, or equivalently its adjacent nodes under the graph’s conventions. It provides a quick measure of local connectivity: low-degree nodes are sparsely connected, while high-degree nodes can dominate unnormalized neighborhood aggregation. section 8.3 section 3.4.3

Use degree statistics as a compact graph-exploration and preprocessing workflow:

  • Count edges or adjacent nodes for every node from an adjacency matrix, adjacency list, or graph object. section 5.2.1 section 8.3
  • Plot a degree histogram to see common connectivity levels, peaks, tails, and unusually prominent nodes. section 5.2.1 section 8.3.3
  • Sort degrees into a rank plot to inspect how quickly connectivity falls from the most connected nodes. section 8.3.3
  • Account for disconnected components before interpreting degree statistics or selecting a graph subproblem. section 8.3.3

Amazon Electronics and social graphs

The Amazon co-purchaser graph contains 7,650 nodes and more than 143,000 edges, yet remains very sparse. Most nodes have degree below 10, a second peak appears around 30, and only a few nodes have very high degree. A social-graph workflow uses NetworkX’s degree method, then plots sorted degrees and a histogram; roughly three-fourths of nodes have fewer than 20 adjacent nodes. section 5.2.1 section 8.3.3

Figure 8.13 Visualization and statistics of the social graph and its large connected component. Network visualization using NetworkX default settings (top). A rank plot of node degree of the entire graph (bottom left). We see that about three-fourths of nodes have less than 20 adjacent nodes. A histogram of degree (bottom right).
figure

Compare a degree-rank plot with a degree histogram to see both prominent nodes and the overall connectivity distribution. section 8.3.3

How Graph Neural Networks in Action covers it

How deep it goes
Defines degree and develops counting, ranking, histogramming, and normalization implications without deriving the full GCN equations.
Examples
Demonstrates degree distributions with Amazon Electronics and social graphs using sparse tensors, NumPy, NetworkX, rank plots, and histograms.
What it assumes
Assumes basic graph representations and teaches degree alongside adjacency structures, components, masks, ranks, and subgraphs.
What you can do after
Diagnose graph connectivity and degree imbalance with Python, NumPy, PyTorch, and NetworkX statistics and visualizations.
How it connects
Connects node degree to adjacency matrices, adjacency lists, edge lists, connected components, and GCN message passing.

Also explained in

Compare how 4 books explain node degree →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.