A graph is just dots joined by lines. The dots are vertices, the lines are edges. That is the whole idea. Graphs model anything where things connect to other things: roads between towns, friends in a group, tasks in a project.
Every edge has two ends, so it adds 2 to the total degree. This is the handshaking lemma, and it is your built-in check: count degrees, halve the total, you get the number of edges.
A tree is a connected graph with no cycles (no loops back to where you started). Connect 6 towns with the fewest possible roads and you always use 5.
A graph has vertices P, Q, R, S, T with edges PQ, PR, QR, QS, RS, ST. Find each degree and verify the handshaking lemma.
β’ Degree counts edges, not other vertices, a loop (edge to itself) counts as 2.
β’ The number of odd-degree vertices decides if you can trace the graph in one go (that's Euler paths, next).
β’ A tree has no cycles, the moment there's a loop back, it's not a tree.
β’ Use the handshaking lemma to check your degree count: it must come to an even number.
4 vertices, 5 edges. Degrees: A=3, B=2, C=3, D=2. Sum = 10 = 2 Γ 5 edges. β The diagonal A to C is what gives A and C their extra degree.
Picture each edge as two hands meeting. One edge, two hands. So if you count every "hand" (every degree) you've counted each edge twice. That's why the sum of degrees is always double the number of edges.
6 dots, joined with the fewest lines that keep them all connected = 5 edges, and not one cycle. That's a tree: n vertices, n β 1 edges.
Don't read yet, just have a go in your head:
Edges PQ, PR, QR, QS, RS, ST. Degrees: P=2, Q=3, R=3, S=3, T=1. Sum = 12. Check: 6 edges Γ 2 = 12 β.
Same edges. Degrees: P=?, Q=3, R=3, S=3, T=?. Sum = ?
A graph has edges AB, AC, AD, BC. Find every degree, then use the handshaking lemma to check. How many edges? Check below.
A connected graph has 8 vertices and 9 edges. Could it be a tree? Explain.
In one sentence, out loud: what does the handshaking lemma let you check? If you can say it, you've got it.