Menu
Sign up Sign in

AI HL · AHL 1

Graph Theory

AHL 1.1

What is a graph? Vertices, edges and trees

AHL 1.1

What is a graph? Vertices, edges and trees

Target: I can model a map, a network of bridges or a transport map as a graph, and read off vertices, edges, degrees and weights. (+4 more)

By the end of this section

Key points

Graphs

  • A graph is a set of vertices (points) joined by edges (lines). Vertices that share an edge are adjacent.
  • The degree of a vertex is the number of edges at it. A loop counts twice.
  • The degrees add up to twice the number of edges, because each edge has two ends.
  • Edges can carry weights: a distance, a time or a cost. A graph with weights is a weighted graph.

Kinds of graph

  • Simple: no loops, and at most one edge between two vertices.
  • Connected: there is a route between every pair of vertices.
  • Complete: every pair of vertices is joined by exactly one edge. The complete graph Kn has \(\frac{n(n-1)}{2}\) edges.
  • Subgraph: a graph made from some of the vertices and edges of another graph.
  • Tree: a connected graph with no cycle. A tree on n vertices has n − 1 edges. Having n − 1 edges is not enough on its own: check that the graph is connected.

Modelling

  • To model a map, decide what the vertices are (places, areas of land) and what the edges are (roads, bridges). Draw only that.
  • Königsberg had seven bridges between four areas of land. Euler used a graph to show that no walk crosses each bridge once. This was the first problem in graph theory.
  • Two bridges between the same two areas are two edges. A graph with repeated edges is not simple.

Directed graphs

  • In a directed graph each edge has an arrow. It can be used in one direction only, like a one-way street.
  • Out-degree counts the edges leaving a vertex. In-degree counts the edges arriving.

On the calculator

Edges of a complete graph

  • If a complete graph has E edges, write \(n^2-n-2E=0\).
  • Enter the coefficients 1, −1, −2E in the polynomial solver.
  • Choose the positive root: n is a number of vertices.

Screenshot and video to come

Explore: build a graph

Press a vertex, then another, to add an edge. Press one vertex twice for a loop. Press an edge to remove it. Drag a vertex to move it.

Adjacency matrix. A loop counts 2.
Simple
Connected
Complete
Tree

Press a vertex, then another, to add an edge.

  1. Start from the ring. Add an edge and watch the sum of the degrees. By how much does it change, and why?
  2. Remove edges from the ring one at a time. When does the graph become a tree? What happens if you remove one more?
  3. Press Join every pair. How many edges are there? Add a vertex and do it again. Can you explain the number?
  4. Switch to Directed. Which vertex has the greatest out-degree? Add an edge and say which row sum and which column sum change. Why is the matrix not symmetric?

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
The bridges of Königsberg

In the 1730s the town of Königsberg had seven bridges linking four areas of land: the north bank A, the island B, the south bank C and the east bank D. The graph models the bridges: each area is a vertex and each bridge is an edge. Can you walk across every bridge exactly once?

ABCD
Working
  1. The graph

    Edges: AB, AB, BC, BC, AD, BD, CD

    Vertices are land, edges are bridges. Two bridges between the same areas are two edges.

  2. Degrees

    A: 3, B: 5, C: 3, D: 3

    The degree of a vertex is the number of edges at it. All four degrees are odd.

  3. Try a walk

    Four odd vertices: no such walk

    In the middle of a walk you go in by one bridge and out by another, so each area visited in the middle uses bridges in pairs. Only the start and the end can have an odd degree. Four odd areas is too many. Euler explained this in 1736, the first problem of graph theory.

Video walkthrough coming
A ferry map as a graph

The graph shows ferry crossings between six harbours. The number on each edge is the crossing time in minutes. Write down the number of vertices and edges, the degree of D, and the total of the weights.

2530201522182812ABCDEF
Working
  1. Vertices and edges

    6 vertices, 8 edges

    The harbours are the vertices, the crossings are the edges.

  2. Degree of D

    D is joined to A, B and E: degree 3

    Count the edges at D.

  3. Total weight

    25 + 30 + 20 + 15 + 22 + 18 + 28 + 12 = 170 minutes

    A weight is a number on an edge. Here it is a time. Add every edge once.

Video walkthrough coming
Is it a tree?

Graph H has 6 vertices and 5 edges, as shown. Is H a tree?

ABCDEF
Working
  1. Count

    6 vertices, 5 edges

    A tree on 6 vertices has 6 − 1 = 5 edges, so the count matches. That is not enough.

  2. Connected?

    No: A, B, C are not joined to D, E, F

    A tree is connected: there is a route between every pair of vertices.

  3. Cycles?

    Yes: A–B–C–A

    A tree has no cycle.

  4. Decide

    H is not a tree

    It fails both tests. Having n − 1 edges does not make a graph a tree.

Video walkthrough coming
Complete graphs

The diagram shows the complete graph K5, in which every vertex is joined to every other by exactly one edge. How many edges does the complete graph K6 have?

ABCDE
Working
  1. Degree of each vertex

    In K6 each vertex is joined to the other 5: degree 5

    Check with K5: each vertex has degree 4.

  2. Sum of degrees

    6 × 5 = 30

    Add the degrees of all six vertices.

  3. Halve

    30 ÷ 2 = 15 edges

    Each edge has two ends, so it was counted twice. In general Kn has \(\frac{n(n-1)}{2}\) edges.

Video walkthrough coming
Simple graphs and subgraphs

Graph G has two edges joining Q and R. (a) Is G simple? (b) One of the QR edges is deleted to give a subgraph H. Is H simple? Is H a tree?

PQRST
Working
  1. G is not simple

    Two edges join Q and R

    A simple graph has no loops and at most one edge between two vertices.

  2. H is simple

    H has 5 vertices and 5 edges

    A subgraph uses some of the vertices and edges of G. Now there is one QR edge.

  3. Not a tree

    H is connected but P–Q–R–S–T–P is a cycle

    A tree on 5 vertices has 4 edges. H has 5.

Video walkthrough coming