Graph Terminology
Vertices and Edges
A graph consists of a set of vertices (nodes) and a set of edges (arcs) . We only consider finite graphs where and are finite.
Directed graphs have ordered pairs , drawn with an arrow from (tail) to (head). is the source and the destination of the edge. Undirected graphs have unordered pairs (or the edge relation is symmetric); an undirected edge is conceptually equivalent to having both directed edges and .
A simple graph has no self-loops (edges from a vertex to itself: ) and no parallel edges (multiple edges between the same ordered pair of vertices). Unless stated otherwise, the syllabus deals with simple graphs. A multigraph allows parallel edges; a pseudograph also allows self-loops.
A weighted graph associates a real number with each edge via a function . Weights represent cost, distance, time, capacity, or any additive metric. Unweighted graphs can be considered as having unit weight on every edge.
Degree
The degree of a vertex in an undirected graph is the number of edges incident at that vertex. In directed graphs:
- In-degree : number of edges entering .
- Out-degree : number of edges leaving .
Handshaking lemma: For an undirected graph, . For directed graphs, . A corollary: the number of odd-degree vertices in any undirected graph is always even.
Paths, Walks, and Cycles
A walk is any sequence of vertices where consecutive pairs are edges. A trail is a walk with no repeated edges. A path is a walk with no repeated vertices (except possibly the first/last). A simple path has no repeated vertices at all. The length of an unweighted path is the number of edges traversed ( for vertices). For weighted graphs, the path length is the sum of edge weights along the path.
A cycle (or circuit) is a path of length at least 1 that starts and ends at the same vertex with no other vertex repeated. A graph with no cycles is acyclic.
Connectivity
An undirected graph is connected if there exists a path between every pair of vertices. A connected component is a maximal connected subgraph. The components partition the vertex set.
For directed graphs, we distinguish:
- Weak connectivity: the underlying undirected graph (ignoring edge directions) is connected.
- Strong connectivity: for every ordered pair , there is a directed path from to .
Subgraphs
- Subgraph: with and .
- Induced subgraph: select and include all edges from whose both endpoints are in .
- Spanning subgraph: (contains all vertices, subset of edges).
Trees and Forests
A free tree (or simply tree) is a connected, acyclic undirected graph. Equivalent characterisations for a graph with vertices:
- Connected and has exactly edges.
- Acyclic and has exactly edges.
- Any two vertices are connected by exactly one simple path.
- Connected, and removing any edge disconnects the graph (minimally connected).
- Acyclic, and adding any edge creates exactly one cycle (maximally acyclic).
A forest is an acyclic undirected graph (a collection of disjoint trees). A forest with components has edges.
Density
| Classification | Edge count | Example |
|---|---|---|
| Sparse | Road network, planar graph | |
| Dense | Complete graph |
A complete graph has . Most real-world graphs are sparse.
Example
Consider a road network: Cambridge (C), Oxford (O), London (L), York (Y). Roads: C—O (80), C—L (55), L—Y (210).
- , . , .
- , , , .
- The graph is connected but not complete (missing 3 possible edges).
- , so it is sparse.
Summary
| Term | Definition |
|---|---|
| Graph | |
| Directed | Ordered pairs |
| Undirected | Unordered pairs |
| Simple graph | No self-loops, no parallel edges |
| Weighted graph | |
| Degree | Incident edges per vertex |
| Path | Sequence of distinct vertices connected by edges |
| Cycle | Closed path, no vertex repeated except start=end |
| Connected | Path exists between every pair |
| Tree | Connected and acyclic; |
| Sparse | |
| Dense |
Past paper questions: y2025p1q9 (connected components, BFS on adjacency matrix).