Warning

This note is not in the study design.

It may contain information that is not relevant to the exam.

Maximum distance between two nodes within a connected graph, where distance between two vertices is defined as the length of the shortest path between the two nodes. It is denoted , and a deliberate way to confuse things is by calling it the “length of the longest shortest path”.

This is better illustrated by an example.

Definitions and Properties

Define a graph . Define to be the distance between the two nodes such that . Intuitively:

    • this is the diameter when the graph consists of a single node
  • , where are adjacent
  • If , then .

Disconnected graphs

Distance is not defined for disconnected graphs, hence some areas say it is infinite1, undefined, etc - what is emphasised is that that there is no standard definition.

Example

Find the diameter of the following graph:

Step 1: List all the distances between each node pair. Exclude the distance to itself (i.e. ) and the distance between a node and an adjacent node:

Step 2: Find the maximum within these distances. This will be the diameter. Hence, will be the diameter.

Footnotes

  1. https://mathworld.wolfram.com/GraphDiameter.html