AI Glossary / Mathematics and optimization / Intermediate
Node degree
Definition
Node degree measures the connections incident to a node in a graph. In a simple undirected graph without self-loops, it equals the number of distinct neighbors. Weighted degree sums connection weights instead of merely counting connections. Directed graphs distinguish incoming degree from outgoing degree, so the graph type and counting convention must be stated.
What it means
Degree is a local description: it concerns a node's immediate connections. A node with degree five has five neighbors in a simple undirected graph, but that number alone does not tell us how far it is from the rest of the network or whether its neighbors connect to each other.
The supplied glossary begins with neighbor count and extends the term to weighted degree. That is appropriate for its simple-graph setting. More general graphs require care: multiple edges can increase degree without adding a new neighbor, and a self-loop convention can count two incident ends at the same node.
How it works
For an unweighted simple undirected graph, count the edges touching the node. Equivalently, sum its row in a binary adjacency matrix with zero diagonal. For nonnegative weighted edges, summing the incident weights gives a weighted degree, also often called node strength.
In a directed graph, count arriving edges for in-degree and departing edges for out-degree. Total degree commonly adds the two. A directed self-loop contributes once to each; in an undirected graph, the standard edge-incidence convention counts a loop twice.
In an undirected graph, summing unweighted degrees counts each edge twice. Thus the degree sum is 2m for m edges, using the loop convention just described. For a loop-free weighted undirected graph, the weighted-degree sum is twice the total edge weight. These identities are useful checks on a representation, but they do not verify the truth of its underlying relationships.
Three practical examples
1. Communication planning: count direct connections at a device to understand the number of peers involved in a neighbor-based exchange protocol.
2. Customer networks: compare how many distinct accounts interact with an account, while separately measuring interaction volume through edge weights.
3. Graph learning: use node degrees when normalizing neighbor contributions so that the aggregation rule accounts for different neighborhood sizes rather than treating every raw sum identically.
Think of it this way
Think of a station with several direct routes. Counting routes describes how many direct connections it has; adding service frequencies describes a different aspect of activity.
The analogy captures unweighted versus weighted degree, but route count is not a complete importance score. A small station can be a crucial bridge between regions, and a busy station can sit inside a well-connected local cluster. Graph degree similarly describes only one part of network structure.
Worked example
Consider four nodes A, B, C, and D. Their undirected edges are AB with weight three, AC with weight one, AD with weight two, and BC with weight four. No loops or parallel edges are present.
The unweighted degrees are d(A)=3, d(B)=2, d(C)=2, and d(D)=1. Their sum is eight, twice the four edges, and their average is 8/4=2.
The weighted degrees are s(A)=3+1+2=6, s(B)=3+4=7, s(C)=1+4=5, and s(D)=2. Their sum is twenty, twice the total edge weight 3+1+2+4=10. A has the most neighbors, but B has the highest weighted degree. Neither ranking is inherently the correct one without knowing what the weights mean.
If the same graph is extended with a self-loop at D, its standard unweighted degree rises from one to three because the loop contributes two ends. D does not gain two distinct new neighbor identities. This is why a general software degree result should not always be described as a count of different other nodes.
Illustrative case study
Fictional case study: a marketplace dashboard ranks sellers by a quantity labeled “connections.” One version counts distinct buyer relationships; another sums purchase counts stored on those relationships. Managers receive different rankings and assume that one calculation is broken.
The data team labels the measures separately as distinct-neighbor count and weighted degree, documenting the reporting period. Both can be useful, but they answer different questions. The team also checks whether duplicate records accidentally create parallel edges. The case illustrates metric definition and data quality, not a claim that highly connected sellers provide better service.
Common misconceptions and mistakes
Do not equate high degree with trustworthiness, influence, or business value. Those interpretations need additional evidence and a relevant decision context.
Do not compare weighted degrees when edge weights use different units or aggregation windows. A sum of transaction counts is not directly comparable with a sum of similarity scores.
Do not confuse in-degree with out-degree. In a citation graph, citing many papers and being cited by many papers describe different directions. Finally, a graph's average degree can hide a few highly connected nodes alongside many isolated ones.
Business use
Degree can support network summaries, workload estimates, and initial investigation of unusually connected or isolated entities. It is often a useful starting point because its definition is simple and its calculation can be inspected directly.
Record whether the measure counts distinct neighbors, edge incidences, or weights, and whether it includes direction, loops, or repeated relationships. Compare values within a consistent network scope. If an organization expands data collection, degrees can rise simply because more relationships are observed, without any real change in the entities' behavior.
People also ask
Is degree the same as number of neighbors?
Yes for a simple undirected graph without self-loops. General graphs can require a different edge-incidence count.
Can weighted degree be non-integer?
Yes. If weights are fractional similarities or other real-valued quantities, their sum need not be an integer.
Does degree measure distant connections?
It measures incident connections. Reachability, path lengths, and broader centrality require other graph quantities.
Check your understanding
Why does A rank above B by unweighted degree but below B by weighted degree in the example?
Answer: A connects to three nodes and B to two, but B's incident weights sum to seven while A's sum to six. Connection count and total connection weight measure different properties.
Related terms
- Neighbor
- edge
- adjacency matrix
- in-degree
- out-degree
- node strength
- degree distribution
- centrality
- self-loop
Learn next
compare degree with a path-based measure on a graph containing two dense groups connected by a small bridge. Then examine how counting transactions as parallel edges differs from storing their count as one edge weight.
More in Mathematics and optimization
- Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
- Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
- Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
- Σ-algebra
- Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
- Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.
Sources
Sources: Aalto Dictionary of Machine Learning, node degree: https://aaltodictionaryofml.github.io/ADictML_Main.pdf ; NetworkX, Graph.degree: https://networkx.org/documentation/stable/reference/classes/generated/networkx.Graph.degree.html ; NetworkX, expected_degree_graph, self-loop convention: https://networkx.org/documentation/stable/reference/generated/networkx.generators.degree_seq.expected_degree_graph.html . Relevant primary definitions and loop-counting notes were read. The simple-graph limitation of neighbor-count wording is explicit. The weighted graph and fictional case are original.
Previous: Node (decision tree) Next: node2vec