How to Find the Degree of a Graph
Introduction
Finding the degree of a graph is a fundamental skill in graph theory, because the degree of each vertex tells you how many edges are incident to that vertex. But whether you are analyzing social networks, routing algorithms, or chemical structures, the degree provides insight into connectivity, influence, and possible pathways. This article explains the concept step by step, shows how to compute degrees for both undirected and directed graphs, and offers practical tips to avoid common mistakes.
What Is the Degree of a Vertex?
In graph terminology, a vertex (also called a node) is a point that can be connected to other vertices by edges (or links). The degree of a vertex is defined as the number of edges that touch it.
- For an undirected graph, each edge contributes one to the degree of each of its two endpoints.
- For a directed graph, the concept splits into in‑degree (edges arriving at the vertex) and out‑degree (edges leaving the vertex).
Italic emphasis is used here to highlight the distinction between these two types of degree.
Degree in Undirected Graphs
Basic Definition
The degree of a vertex v in an undirected graph G is denoted deg(v) and equals the count of edges incident to v. If an edge is a loop (connects the vertex to itself), it contributes two to the degree because it touches the vertex twice Most people skip this — try not to..
Visual Inspection
- Identify the vertex whose degree you need.
- Count all edges that have the vertex as an endpoint.
- Include loops twice.
Example: In a simple triangle (three vertices, three edges), each vertex has a degree of 2 because two edges meet at each vertex Most people skip this — try not to..
Using the Handshaking Lemma
The handshaking lemma states that the sum of all vertex degrees in an undirected graph equals twice the number of edges:
[ \sum_{v \in V} \deg(v) = 2|E| ]
This relationship is useful when you know the total number of edges but not each individual degree. To give you an idea, if a graph has 10 edges, the total degree sum must be 20. If you know that most vertices have degree 3, you can infer the remaining degrees But it adds up..
Degree in Directed Graphs
In‑degree and Out‑degree
- In‑degree (deg⁻(v)) counts edges that terminate at vertex v.
- Out‑degree (deg⁺(v)) counts edges that originate from vertex v.
A vertex’s total degree in a directed graph is often taken as the sum of its in‑ and out‑degrees, though some analyses focus on one component separately.
Practical Counting
- Locate the vertex v.
- Count incoming edges → in‑degree.
- Count outgoing edges → out‑degree.
- Add them if you need the total degree.
Example: In a simple directed cycle of three vertices, each vertex has an in‑degree of 1 and an out‑degree of 1, giving a total degree of 2.
Step‑by‑Step Procedure to Find Degrees
- Represent the graph clearly (adjacency list, matrix, or diagram).
- Select the target vertex v.
- If the graph is undirected:
- Scan the adjacency list or matrix for all entries that include v.
- Count each occurrence; add 2 for each loop.
- If the graph is directed:
- Count entries where v appears as a destination → in‑degree.
- Count entries where v appears as a source → out‑degree.
- Record the result as deg(v) (undirected) or deg⁺(v), deg⁻(v) (directed).
Tip: When using an adjacency matrix, the row (or column) corresponding to v contains a 1 for each incident edge. Summing that row gives the degree directly Surprisingly effective..
Common Mistakes and How to Avoid Them
- Forgetting loops: In undirected graphs, a loop adds two to the degree. Always check for self‑connections.
- Confusing in‑ and out‑degree: In directed graphs, remember that the two counts are distinct; mixing them leads to inaccurate totals.
- Misreading adjacency lists: Ensure you count each edge only once per vertex; duplicate entries may appear if the list is not normalized.
- Ignoring isolated vertices: A vertex with no edges has degree 0; this is a valid result and should not be omitted.
Using the Handshaking Lemma for Verification
After you have computed degrees for several vertices, you can verify your work by summing them and comparing the total to twice the number of edges. If the sums match, your counts are likely correct. This quick sanity check is especially helpful in large graphs where manual counting is error‑prone.
Frequently Asked Questions
Q1: Can a vertex have a degree larger than the number of other vertices?
A: Yes. In a complete graph where every vertex connects to every other vertex, a vertex in a graph with n vertices has degree n‑1. Loops can make the degree even larger But it adds up..
Q2: What is a regular graph?
A: A graph is regular if every vertex has the same degree. Here's one way to look at it: a 3‑regular graph (also called cubic) has each vertex incident to exactly three edges.
Q3: How does degree relate to connectivity?
A: Higher degree generally indicates higher connectivity. A vertex with degree 1 is a leaf, while a vertex with degree equal to the total number of vertices minus one is highly central.
Q4: Do weighted edges affect degree?
A: No. Degree counts only the number of edges, not their weights. Weighted graphs are analyzed separately using concepts like total weight or path length Turns out it matters..
Conclusion
Finding the degree of a graph is straightforward once you understand whether the graph is undirected or directed and know how to count incident edges correctly. Mastery of this skill enhances your ability to analyze network structure, assess flow, and apply graph theory to real‑world problems. By following the step‑by‑step procedure, using the handshaking lemma for verification, and avoiding common pitfalls, you can reliably determine vertex degrees in any graph you encounter. Keep practicing with different graph representations, and the process will become second nature Turns out it matters..