Skip to content
IB Diploma ProgrammeSL & HL

Graph theory

Mathematics: Applications and Interpretation SL & HL Chapter Notes

Last updated November 2026

ShareWhatsAppPost

Graph theory notes as a printable PDF.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Graph theory notes as text: skim, search, and jump between subtopics.

~14 min read

1. Graphs, vertices and edges

A graph is a set of vertices joined by edges. A vertex is a point. An edge is a line that joins two vertices.

A graph can represent a real structure. In a map of towns, each town is a vertex and each road is an edge. In a circuit, each junction is a vertex and each wire is an edge. Only the links matter. The length or position of a drawn edge does not.

The command term “state” needs only the answer. A graph that records just whether two vertices are linked is an unweighted graph.

Worked example 13 marks

The graph shows the footpaths between five viewpoints A, B, C, D and E in a park.

(a) State the number of vertices.

(b) State the number of edges.

(c) State what each edge represents.

  1. 1

    (a) A1: 5 vertices [1]

  2. 2

    (b) A1: 5 edges, namely AB, AC, BC, CD and DE [1]

  3. 3

    (c) A1: one footpath between two viewpoints [1]

2. Adjacent vertices, adjacent edges and degree

Two vertices are adjacent if an edge joins them. Two edges are adjacent if they share a vertex.

The degree of a vertex is the number of edges that meet at it. Each edge meets two vertices, so it adds 1 to the degree of each. The degrees therefore add up to twice the number of edges.

For “write down” questions, list the vertices or give the number. A degree counts the edges at one vertex, not the vertices in the whole graph.

sum of the degrees = 2 × number of edges

Worked example 14 marks

The graph shows the roads between five towns P, Q, R, S and T.

(a) Write down the degree of R.

(b) Write down the vertices adjacent to Q.

(c) Use the degrees of all five vertices to find the number of edges.

  1. 1

    (a) A1: the degree of R is 4, from the edges RP, RQ, RS and RT [1]

  2. 2

    (b) A1: P, R and S [1]

  3. 3

    (c) M1: sum of degrees = 2 + 3 + 4 + 2 + 1 = 12 [1]

  4. 4

    A1: number of edges = 12 ÷ 2 = 6 [1]

3. Simple graphs and complete graphs

A simple graph has no loops and no pair of vertices joined by more than one edge. A loop is an edge from a vertex to itself.

A complete graph is a simple graph in which every vertex is joined to every other vertex by exactly one edge. A complete graph on n vertices is written Kn.

In Kn each vertex is joined to the other n - 1 vertices, so every degree is n - 1. The degrees add up to n(n-1), which is twice the number of edges.

degree of each vertex in Kn = n - 1

number of edges in Kn = (n(n-1))/2

Worked example 15 marks

A complete graph has 6 vertices.

(a) Write down the degree of each vertex.

(b) Find the number of edges.

(c) A simple graph has 5 vertices and 8 edges. State, with a reason, whether it is a complete graph.

  1. 1

    (a) A1: each vertex is joined to the other 5, so the degree is 5 [1]

  2. 2

    (b) M1: sum of degrees = 6 × 5 = 30 [1]

  3. 3

    A1: number of edges = 30 ÷ 2 = 15 [1]

  4. 4

    (c) M1: a complete graph on 5 vertices has (5 × 4)/2 = 10 edges [1]

  5. 5

    R1: the graph has 8 edges, not 10, so it is not complete [1]

4. Weighted graphs and connected graphs

In a weighted graph each edge has a number, its weight. The weight can be a distance, a time or a cost. The length of a route is the sum of the weights of the edges it uses.

A graph is connected if there is a path along edges between every pair of vertices. If some vertex cannot be reached from another, the graph is not connected.

To show a graph is connected, give a reason that covers every vertex. To show it is not connected, name one pair of vertices with no path between them.

Worked example 14 marks

The weighted graph shows the lengths, in km, of roads between four towns A, B, C and D.

(a) Write down the weight of the edge BC.

(b) Find the length of the route A, B, C, D.

(c) State, with a reason, whether the graph is connected.

  1. 1

    (a) A1: 3 km [1]

  2. 2

    (b) M1: add the weights along the route, 5 + 3 + 4 [1]

  3. 3

    A1: 12 km [1]

  4. 4

    (c) R1: there is a path between every pair of towns, so the graph is connected [1]

5. Directed graphs: in degree and out degree

In a directed graph each edge has a direction, shown by an arrow. The in degree of a vertex is the number of edges directed into it. The out degree is the number directed out of it.

Every edge leaves one vertex and enters another. The in degrees add up to the number of edges, and so do the out degrees.

A directed graph is strongly connected if, following the arrows, there is a path from every vertex to every other vertex.

sum of in degrees = sum of out degrees = number of edges

Worked example 14 marks

The directed graph shows one-way paths between four points P, Q, R and S.

(a) Write down the in degree and the out degree of R.

(b) Determine whether the graph is strongly connected.

  1. 1

    (a) A1: in degree of R is 1, from Q [1]

  2. 2

    A1: out degree of R is 2, to P and to S [1]

  3. 3

    (b) M1: the cycle P → Q → R → P joins P, Q and R in both directions. R reaches S, and S reaches Q [1]

  4. 4

    R1: every vertex can reach every other vertex, so the graph is strongly connected [1]

6. Subgraphs and trees

A subgraph of a graph G is a graph whose vertices and edges all belong to G. Taking some of the vertices and some of the edges gives a subgraph.

A cycle is a closed path that starts and ends at the same vertex and visits no other vertex twice. A tree is a connected graph with no cycles.

A tree with n vertices has n - 1 edges. A connected graph with more edges than that must contain a cycle.

number of edges in a tree = n - 1

Worked example 13 marks

The graph G shows five vertices A, B, C, D and E.

(a) Write down the edges of a subgraph of G that is a tree and contains all five vertices.

(b) Explain why G is not a tree.

  1. 1

    (a) M1: five vertices need 5 - 1 = 4 edges, with no cycle [1]

  2. 2

    A1: for example AB, AC, CD and CE, which is connected with no cycle [1]

  3. 3

    (b) R1: G contains a cycle, for example A - B - C - A [1]

Recap

  • A graph has vertices joined by edges. The degree of a vertex is the number of edges that meet at it, and the degrees add up to twice the number of edges.
  • Adjacent vertices are joined by an edge. Adjacent edges share a vertex.
  • A simple graph has no loops and no repeated edges. In a complete graph Kn every vertex has degree n - 1 and there are (n(n-1))/2 edges.
  • A weighted graph gives each edge a number. A route's length is the sum of its edge weights. A connected graph has a path between every pair of vertices.
  • A directed graph has in degrees and out degrees. Each set adds up to the number of edges. It is strongly connected if every vertex can reach every other along the arrows.
  • A subgraph uses only vertices and edges of the original graph. A tree is connected with no cycles, and a tree with n vertices has n - 1 edges.

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. State the meaning of the degree of a vertex.1 mark
    Answer
    1. The degree of a vertex is the number of edges that meet at it.

    Trap: Giving the number of vertices in the graph, instead of the number of edges at that one vertex.

  2. Which statement defines two adjacent vertices? A. They have the same degree. B. They are joined by an edge. C. They lie on the same cycle. D. A path of any length joins them.1 mark
    Answer
    1. The answer is B.
    2. A compares degrees and says nothing about a link. C needs a cycle, which adjacent vertices need not lie on. D describes vertices that are connected, not adjacent.

    Trap: Choosing D, which confuses adjacent (joined by one edge) with connected (joined by a path).

  3. A simple graph has five vertices with degrees 3, 2, 2, 1 and 2. Calculate the number of edges.2 marks
    Answer
    1. Sum of degrees = 3 + 2 + 2 + 1 + 2 = 10.
    2. Number of edges = 10 ÷ 2 = 5.

    Trap: Giving 10, the sum of the degrees, without halving it.

  4. A complete graph has 7 vertices. (a) Write down the degree of each vertex. (b) Calculate the number of edges.3 marks
    Answer
    1. (a)
    2. Each vertex is joined to the other 6, so the degree is 6.
    3. (b)
    4. Sum of degrees = 7 × 6 = 42.
    5. Number of edges = 42 ÷ 2 = 21.

    Trap: Using the degree 7, which counts the vertex itself, or leaving the edge count as 42.

  5. The graph shows the roads, with their lengths in km, between four towns A, B, C and D. (a) Calculate the length of the route A, B, C, D. (b) State whether this route is shorter than the direct road AD.3 marks
    Answer
    1. (a)
    2. Length = 6 + 4 + 7.
    3. = 17 km.
    4. (b)
    5. No. 17 km is longer than the direct road of 12 km.

    Trap: Adding all five weights, which gives 38 km, instead of only the three edges the route uses.

  6. The graph shows five vertices A, B, C, D and E. (a) Write down the degree of each vertex. (b) Explain why the graph is not connected.3 marks
    Answer
    1. (a)
    2. A has degree 2, B has degree 2, C has degree 3, D has degree 1 and E has degree 0.
    3. (b)
    4. No edge meets E, so there is no path between E and any other vertex.

    Trap: Blaming vertex D, which has degree 1. A low degree does not break a graph. The reason is E, which has degree 0.

  7. The directed graph shows one-way paths between four points A, B, C and D. (a) Write down the in degree and the out degree of each vertex. (b) Determine whether the graph is strongly connected.4 marks
    Answer
    1. (a)
    2. In degrees: A is 1, B is 1, C is 2 and D is 1. Out degrees: A is 2, B is 1, C is 1 and D is 1.
    3. Check: both sets add up to 5, the number of edges.
    4. (b)
    5. From A: A → B → C → D. From B: B → C → D → A. From C: C → D → A → B. From D: D → A → B and A → C.
    6. Every vertex reaches every other, so the graph is strongly connected.

    Trap: Showing that only one vertex reaches all the others. Strongly connected needs this from every vertex.

  8. (a) Write down the number of edges in a tree with 9 vertices. (b) A connected graph has 9 vertices and 12 edges. Explain why it contains a cycle.4 marks
    Answer
    1. (a)
    2. 9 - 1 = 8 edges.
    3. (b)
    4. A connected graph with no cycle is a tree, so it would have 8 edges.
    5. This graph has 12 edges, not 8, so it is not a tree.
    6. It is connected, so the only way it can fail to be a tree is to contain a cycle.

    Trap: Writing 9 edges in part (a). A tree has one edge fewer than it has vertices.

  9. Seven players enter a chess tournament. The players are the vertices of a simple graph, and an edge joins two players who have played each other. So far 10 games have been played. Four players have each played 3 games, two have each played 2 games, and the seventh player, Mia, has played k games. (a) Find k. (b) Every pair of players must play each other once. Determine how many games are still to be played. (c) State, with a reason, whether Mia could have played 7 games by the end of the tournament.5 marks
    Answer
    1. (a)
    2. Sum of degrees = 2 × 10 = 20.
    3. 4 × 3 + 2 × 2 + k = 20, so 16 + k = 20 and k = 4.
    4. (b)
    5. When every pair has played, the graph is complete: (7 × 6)/2 = 21 edges.
    6. Games still to be played = 21 - 10 = 11.
    7. (c)
    8. No. Mia can play only the other 6 players, so her degree is at most 7 - 1 = 6.

    Trap: Setting the sum of the degrees equal to 10, the number of edges, instead of 2 × 10, which gives k = -6.

  10. The directed graph shows one-way streets between five junctions P, Q, R, S and T. (a) Write down the in degree and the out degree of T. (b) Determine whether it is possible to travel from every junction to every other junction. The council makes the street between S and T two-way. (c) Show that it is now possible to travel from every junction to every other junction.6 marks
    Answer
    1. (a)
    2. The in degree of T is 1 and the out degree of T is 0.
    3. (b)
    4. No street leaves T, so there is no path from T to any other junction.
    5. The graph is not strongly connected.
    6. (c)
    7. The new edge T → S gives T a way out.
    8. The cycle P → Q → R → S → P joins P, Q, R and S in both directions.
    9. S and T now reach each other, so every junction reaches every other and the graph is strongly connected.

    Trap: Deciding the graph is strongly connected because every vertex has an edge into it. Each vertex also needs a way out, and T has out degree 0.

Say this, not that

Wording that loses the mark, against the wording the mark scheme credits.

Loses the markGets the mark
Two vertices are adjacent if they are close together in the drawing.Two vertices are adjacent if an edge joins them. Where they sit on the page does not matter.
A graph is connected if every vertex has an edge.A graph is connected if there is a path between every pair of vertices. Two separate triangles have edges at every vertex but are not connected.
A tree is a graph with no cycles.A tree is a connected graph with no cycles. Two separate paths have no cycle but are not a tree.
The in degree of a vertex is the number of edges leaving it.The in degree is the number of edges directed into the vertex. The out degree is the number directed out of it.

Frequently asked questions

What is a graph in graph theory?
A graph is a set of vertices joined by edges. A vertex is a point, and an edge is a line that joins two vertices. In a map of towns, each town is a vertex and each road is an edge. Only the links matter, so the length or position of a drawn edge does not.
How do I find the number of edges in a graph from its vertex degrees?
The degree of a vertex is the number of edges that meet at it. Each edge adds 1 to the degree of each of its two vertices, so the sum of the degrees is twice the number of edges. For degrees 3, 2, 2, 1 and 2, the sum is 10, so there are 10 ÷ 2 = 5 edges. Do not give the sum as the answer.
What is the difference between adjacent vertices and connected vertices?
Two vertices are adjacent if an edge joins them. A graph is connected if there is a path along edges between every pair of vertices, so vertices can be connected without being adjacent. Two separate triangles have an edge at every vertex but are not connected. A connected graph has a path between every pair of vertices.
How many edges does a complete graph have?
In a complete graph Kn, every vertex is joined to every other vertex by exactly one edge, so each degree is n - 1. The number of edges is (n(n-1))/2. For a complete graph on 7 vertices, each degree is 6, the degrees sum to 42, and there are 42 ÷ 2 = 21 edges.
What is a tree in graph theory, and how many edges does it have?
A tree is a connected graph with no cycles. A tree with n vertices has n - 1 edges. A subgraph with all five vertices of a graph that is a tree needs 5 - 1 = 4 edges and no cycle, for example AB, AC, CD and CE. A connected graph with more edges than that must contain a cycle.
What is the difference between in degree and out degree in a directed graph?
The in degree of a vertex is the number of edges directed into it, and the out degree is the number directed out of it. Every edge leaves one vertex and enters another, so the sum of the in degrees and the sum of the out degrees are both equal to the number of edges. Mixing these up is a common error.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters