What Degree Measures
In a graph, degree is a local measure: it records how many edges meet a particular vertex. Calculating it from an edge list is a basic skill used throughout graph theory. The important step is to fix one vertex and count only the edges incident with it; edges elsewhere in the graph do not contribute.
Throughout this tutorial, graphs are finite and simple. Thus an edge joins two distinct vertices, and there is at most one edge between any two vertices. Write \(G=(V,E)\), where \(V=V(G)\) is the vertex set and \(E=E(G)\) is the edge set. An edge joining \(u\) and \(v\) is written \(uv\). The degree counts edges, not vertices in the whole graph and not the number of edges in \(E\).
The equivalence in the definition depends on simplicity. Each edge incident with \(v\) has exactly one other endpoint, and distinct edges incident with \(v\) have distinct other endpoints. In particular, if no edge is incident with \(v\), then \(\deg(v)=0\); such a vertex is called isolated. A vertex of degree \(1\) is called a leaf or pendant vertex.
Counting from an Edge List
Suppose the graph is specified by its vertex set and edge set. To find \(\deg(v)\), scan the entire edge list and select the entries that contain \(v\) as an endpoint. Count each selected edge once. In the notation \(uv\), the order of the letters does not change the edge: \(uv\) and \(vu\) name the same undirected edge.
Decide which vertex's degree you are calculating.
Include an edge exactly when the chosen vertex is one of its two endpoints.
Count the selected edges, then compare them with the listed neighbors of the vertex.
Worked Example: Degrees in a Graph on Five Vertices
Let \(G=(V,E)\) be the simple graph with \(V=\{a,b,c,d,e\}\) and \(E=\{ab,ac,bc,cd,de\}\). Find the degree of every vertex.
For \(a\), the edges containing \(a\) are \(ab\) and \(ac\), so \(\deg(a)=2\). For \(b\), they are \(ab\) and \(bc\), so \(\deg(b)=2\). For \(c\), they are \(ac\), \(bc\), and \(cd\), so \(\deg(c)=3\). For \(d\), they are \(cd\) and \(de\), so \(\deg(d)=2\). For \(e\), the only edge containing \(e\) is \(de\), so \(\deg(e)=1\).
Check using neighborhoods: \(N(a)=\{b,c\}\), \(N(b)=\{a,c\}\), \(N(c)=\{a,b,d\}\), \(N(d)=\{c,e\}\), and \(N(e)=\{d\}\). Their sizes are \(2,2,3,2,1\), respectively, agreeing with the incident-edge counts.
The check by neighborhoods is useful because it gives a second description of the same local information. It is not a different convention for degree: in a simple graph, each neighbor corresponds to exactly one incident edge. When working from an edge list, however, counting the edges directly is often the quickest method.
Why Degree Equals Neighborhood Size
Proof. Fix a vertex \(v\). For each edge incident with \(v\), take its endpoint other than \(v\). This endpoint exists and is unique because every edge in a simple graph joins two distinct vertices. It belongs to \(N(v)\). Conversely, for every vertex \(u\in N(v)\), the edge \(uv\) is incident with \(v\). These two assignments undo one another: the edge \(uv\) corresponds to the neighbor \(u\), and the neighbor \(u\) corresponds to the edge \(uv\). Therefore the incident edges at \(v\) and the vertices in \(N(v)\) are in one-to-one correspondence. Their numbers are equal, so \(\deg(v)=|N(v)|\). This also covers an isolated vertex: both sets are empty and both numbers are \(0\). \(\square\)
Worked Example: Finding an Isolated Vertex
Let \(H=(V,E)\) have \(V=\{1,2,3,4,5,6\}\) and \(E=\{12,23,24,45\}\). Find all vertex degrees and identify any isolated vertices or leaves.
Vertex \(1\) appears only in edge \(12\), so \(\deg(1)=1\). Vertex \(2\) appears in \(12,23,24\), so \(\deg(2)=3\). Vertex \(3\) appears only in \(23\), so \(\deg(3)=1\). Vertex \(4\) appears in \(24,45\), so \(\deg(4)=2\). Vertex \(5\) appears only in \(45\), so \(\deg(5)=1\). Vertex \(6\) appears in no edge, so \(\deg(6)=0\).
The neighborhoods confirm the calculation: \(N(1)=\{2\}\), \(N(2)=\{1,3,4\}\), \(N(3)=\{2\}\), \(N(4)=\{2,5\}\), \(N(5)=\{4\}\), and \(N(6)=\varnothing\). Thus \(1,3,5\) are leaves, and \(6\) is isolated.
Check: Each listed edge has two endpoints, and the degrees obtained by counting at those endpoints agree with the neighborhoods. In particular, the absence of \(6\) from the edge list gives it no incident edges; it does not remove \(6\) from the vertex set.
This last point matters whenever a graph is specified by both \(V\) and \(E\). A vertex can belong to \(V\) without appearing in any edge. Its degree is still defined, and is \(0\). An edge list alone may not make isolated vertices visible, so read the stated vertex set as well as the edge set.
How a Single Edge Changes Degrees
Degree calculations can also be updated when one edge is added or deleted. The rule concerns only the endpoints of that edge. For an addition, the proposed edge must not already be present, and its endpoints must be distinct; these conditions ensure that the resulting graph remains simple. For a deletion, the edge must be present.
Proof. First suppose \(uv\notin E(G)\). Adding \(uv\) introduces one new edge incident with \(u\) and one new edge incident with \(v\), so each of their incident-edge counts increases by exactly \(1\). Because \(u\ne v\), no other vertex is an endpoint of the new edge. Thus no other vertex's incident-edge count changes. Now suppose \(uv\in E(G)\) and delete it. The deleted edge was counted once in the degree of \(u\) and once in the degree of \(v\), so each of those counts decreases by exactly \(1\). No other vertex was an endpoint of \(uv\), so every other degree stays the same. \(\square\)
Worked Example: Updating Degrees After an Edge Change
Let \(J=(V,E)\) have \(V=\{p,q,r,s\}\) and \(E=\{pq,qr,rs\}\). Find the degrees before and after adding \(ps\), and then after deleting \(qr\) from the graph with the added edge.
In the original graph, \(p\) is in \(pq\), so \(\deg(p)=1\). Vertex \(q\) is in \(pq,qr\), so \(\deg(q)=2\). Vertex \(r\) is in \(qr,rs\), so \(\deg(r)=2\). Vertex \(s\) is in \(rs\), so \(\deg(s)=1\).
The edge \(ps\) is absent and \(p\ne s\), so it can be added while keeping the graph simple. After adding it, the edge set is \(\{pq,qr,rs,ps\}\). The new degrees are \(\deg(p)=2\), \(\deg(q)=2\), \(\deg(r)=2\), and \(\deg(s)=2\): only \(p\) and \(s\) increased, each by \(1\).
Now delete \(qr\). The edge set becomes \(\{pq,rs,ps\}\). Counting again gives \(\deg(p)=2\), \(\deg(q)=1\), \(\deg(r)=1\), and \(\deg(s)=2\). Only \(q\) and \(r\), the endpoints of the deleted edge, decreased, each by \(1\).
Check: In the final graph, \(N(p)=\{q,s\}\), \(N(q)=\{p\}\), \(N(r)=\{s\}\), and \(N(s)=\{r,p\}\). The neighborhood sizes \(2,1,1,2\) match the degrees just calculated.
Common Mistake: Confusing Degree with Edge Count
A graph's size \(m=|E(G)|\) is the total number of edges in the graph. The degree \(\deg(v)\) is the number of those edges that meet a particular vertex \(v\). These are different quantities, so the total edge count is not automatically the degree of any vertex.
For example, in the graph with \(V=\{a,b,c,d\}\) and \(E=\{ab,bc,cd\}\), there are three edges. The incorrect calculation “\(\deg(b)=3\), because the graph has three edges” counts every edge, including \(cd\), which does not meet \(b\). The correction is to select only \(ab\) and \(bc\), giving \(\deg(b)=2\). The neighborhood check gives \(N(b)=\{a,c\}\), again of size \(2\).
Another error is to forget a vertex that does not appear in any edge. In the worked example on six vertices, \(6\) is still a vertex and has degree \(0\). Always use the full vertex set when reporting which vertices have been assigned degrees.
Check Your Understanding
For each question, use the stated vertex set and edge list; include vertices of degree \(0\) in your answer.
- Let \(G\) have \(V=\{a,b,c,d\}\) and \(E=\{ab,ac,ad\}\). Find the degree of each vertex and identify any leaves.
- Let \(H\) have \(V=\{1,2,3,4,5\}\) and \(E=\{12,23,34\}\). Which vertex is isolated? Give the degree of every vertex.
- Prove directly from the definitions that if \(\deg(v)=0\), then \(N(v)=\varnothing\), and conversely.
- Suppose \(uv\) is an edge of a simple graph. What happens to the degrees of \(u\), \(v\), and a third vertex \(w\) when \(uv\) is deleted? Explain using incident edges.
- For \(V=\{p,q,r\}\) and \(E=\{pq,pr\}\), a student claims \(\deg(q)=2\) because there are two edges. State the correct degree and identify the counting error.