Data Structures: Graphs
A graph is a collection of nodes (vertices) connected by edges. Graphs can be directed or undirected and are used to model relationships, networks, and paths. They are essential in social networks, routing algorithms, and dependency analysis in computer science.
Theory
Graphs are a popular topic in A-level examinations. You will need to have an understanding of the theory and be able to perform Dijkstras and A* path finding algorithms.
What is a graph?
- A graph is a data structure
- A graph is a collection of vertices (nodes) and edges (connections)
- A graph can be directed or undirected
- A graph can be weighted or unweighted
What are heuristics?
- Make use of experience for example an Educated guess / rule of thumb approach
- when finding an optimal solution is impractical or impossible in a reasonable time frame
- Not guaranteed to produce the best solution but will produce a ‘good enough’ result.
Interactive Graph
Select Dijkstras or A* and click the generate button to generate a random graph question
Check your understanding
Download a worksheet to test your understanding and strengthen your skills!
Browse Worksheets