You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers graphs — a versatile data structure used to model relationships between objects. Graphs are fundamental to A-Level Computer Science and underpin routing, social networks, pathfinding, and many other applications.
A graph G is defined as a set of vertices (nodes) V and a set of edges (connections) E that connect pairs of vertices:
G = (V, E)
Unlike trees, graphs can contain cycles (paths that start and end at the same vertex), and there is no hierarchy (no root node).
| Term | Definition |
|---|---|
| Vertex (Node) | A data point in the graph. |
| Edge (Arc) | A connection between two vertices. |
| Adjacent | Two vertices connected by an edge are adjacent (neighbours). |
| Degree | The number of edges connected to a vertex. |
| Path | A sequence of vertices connected by edges. |
| Cycle | A path that starts and ends at the same vertex. |
| Connected graph | There is a path between every pair of vertices. |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.