IB Maths AI HL Graph Theory Paper 1 & 2 Vertices & edges ~8 min read

Introduction to Graph Theory

A graph is just a set of dots (called vertices) joined by lines (called edges). It’s the maths of connections — how things are linked, not where they are. Whether you’re modelling a road network, a friendship circle, or a flight map, the same vocabulary works: count the vertices, count the edges, count how many edges meet at each vertex (its degree), and apply the Handshaking Lemma: the sum of all degrees is always twice the number of edges.

šŸ“˜ What you need to know

Vertices, edges, and degree

Think of a graph as a map of relationships. The vertices are the things (people, cities, websites, atoms), and the edges are the connections (friendships, roads, hyperlinks, bonds). The picture doesn’t have to be drawn neatly — only which vertices are joined matters, not where they sit on the page. Two graphs that look different but have the same connections are the same graph.

The degree of a vertex is simply how many edges touch it. Count the lines coming out of each dot — that’s the degree. A loop (an edge from a vertex back to itself) goes in and out of the same vertex, so it adds 2 to that vertex’s degree, not 1. Every edge has two ends, so when you add up the degrees of every vertex, you’re counting each edge twice. That’s the Handshaking Lemma.

A graph: vertices, edges, and the degree at each vertex A deg = 2 B deg = 3 C deg = 4 D deg = 3 E deg = 2 Ī£ deg = 2 + 3 + 4 + 3 + 2 = 14 = 2 Ɨ 7 edges āœ“ Graph theory toolkit ā‘  Graph G = (V, E) vertices V joined by edges E ā‘” Degree deg(v) = edges at v a loop counts as 2 ā‘¢ Handshaking Lemma Ī£ deg(v) = 2 |E| sum of degrees is always even ā‘£ Complete graph Kn |E| = n(n āˆ’ 1) / 2
Graph with 5 vertices and 7 edges. Degrees: 2, 3, 4, 3, 2 — their sum is 14, exactly twice the edge count. This is the Handshaking Lemma in action.
The Handshaking Lemma Σ deg(v) = 2|E| the sum of all vertex degrees equals twice the number of edges

Types of graphs, and how we travel through them

Different graphs come with different rules. A simple graph has no loops and no repeated edges — the cleanest, most common type, and what most exam questions use unless they say otherwise. A complete graph Kn takes n vertices and connects every pair, giving n(n−1)2 edges — the maximum possible for a simple graph. A connected graph has a route between every pair of vertices; if any vertex is cut off, the graph is disconnected. A tree is connected but has no cycles, and satisfies the neat rule |E| = |V| − 1.

To travel through a graph means moving from one vertex to another along edges. The travel words sound similar but mean different things:

Memory tip: walk is the loosest, path is the strictest. As you tighten the rules, you go walk → trail → path. Add “closed” (start = end) and you get circuit and cycle.

🧭 Recipe — analysing a graph

  1. Count vertices and edges: |V| = number of dots, |E| = number of lines. Loops count as one edge each.
  2. Find each degree: count edges meeting that vertex. Add 2 for every loop at that vertex.
  3. Check Handshaking: Σ deg(v) should equal 2|E|. If not, recount.
  4. Identify the type: simple (no loops, no repeats), complete (every pair joined), connected (all vertices reachable), tree (connected, no cycles).
  5. For travel questions: list the vertex sequence, then check whether edges or vertices are repeated to classify as walk, trail, path, circuit, or cycle.

Worked examples

WE 1

List vertices, edges, and degrees

A graph G has edge set E = { AB, AC, BC, BD, CD }. List the vertices, find |V| and |E|, and give the degree of every vertex.

vertices appearing in E V = { A, B, C, D } → |V| = 4 |E| = 5 degrees (count each vertex’s edges) deg(A) = 2 (AB, AC) deg(B) = 3 (AB, BC, BD) deg(C) = 3 (AC, BC, CD) deg(D) = 2 (BD, CD) handshaking check Ī£ deg = 2 + 3 + 3 + 2 = 10 = 2 Ɨ 5 āœ“ |V| = 4, |E| = 5 always do the handshaking check — it catches counting mistakes instantly.
WE 2

Find the missing degree using the Handshaking Lemma

A graph has 8 edges and 5 vertices with degrees 2, 3, 3, 4, and x. Find x.

apply the Handshaking Lemma Ī£ deg(v) = 2 |E| 2 + 3 + 3 + 4 + x = 2 Ɨ 8 12 + x = 16 x = 4 x = 4 no need to draw the graph — the lemma alone gives the answer.
WE 3

Show that a graph cannot exist

Determine whether a graph with five vertices having degrees 3, 3, 3, 3, and 3 can exist.

sum of degrees Ī£ deg = 3 + 3 + 3 + 3 + 3 = 15 by Handshaking, Ī£ deg must be even 15 is odd → contradiction no such graph exists rule of thumb: the number of vertices with odd degree is always even. Five odd-degree vertices breaks this.
WE 4

Edges in a complete graph

How many edges does the complete graph K7 have? What is the degree of every vertex in K7?

edges in K_n |E| = n(n āˆ’ 1) / 2 = 7 Ɨ 6 / 2 = 21 degree in K_n: every vertex joins to the other nāˆ’1 deg(v) = 7 āˆ’ 1 = 6 handshaking check Ī£ deg = 7 Ɨ 6 = 42 = 2 Ɨ 21 āœ“ |E| = 21, deg(v) = 6 for every v in K_n every vertex has the same degree n āˆ’ 1 — it’s called “regular”.
WE 5

Classify a sequence of vertices

In a graph with vertices { A, B, C, D, E } and edges { AB, BC, CD, DE, EA, AC }, classify each sequence as a walk, trail, path, circuit, or cycle (use the strictest label that applies):
(a) A → B → C → D → E
(b) A → B → C → A → E → D → C
(c) A → B → C → A

(a) A → B → C → D → E no vertex repeated, no edge repeated not closed (A ≠ E) (a) is a path (b) A → B → C → A → E → D → C edges used: AB, BC, CA, AE, ED, DC — all different but vertex C and A repeat → not a path (b) is a trail (not a path) (c) A → B → C → A no edge repeated, no vertex repeated (except start = end) closed (c) is a cycle work from the strictest label downwards: try “path” first, then “trail”, then “walk”.
WE 6

Tree property — number of edges

A tree has 12 vertices. How many edges does it have? If a new edge is added to the tree, what must happen?

tree formula |E| = |V| āˆ’ 1 = 12 āˆ’ 1 = 11 |E| = 11 edges adding an edge to a tree tree is already connected with no cycles a new edge joins two vertices already linked by a path a cycle is created a tree is the leanest possible connected graph — one extra edge forces a cycle, one missing edge disconnects it.

šŸ’” Top tips

⚠ Common mistakes

Next up — Adjacency Matrices. Once you can describe a graph, the next step is storing it as a matrix: rows and columns indexed by vertices, with a 1 (or weight) where an edge exists. Powers of the adjacency matrix then count walks of given lengths between pairs of vertices — the gateway to all the powerful algorithmic graph theory in the IB AI HL course.

Need help with Graph Theory?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →