Representing Graphs

We typically represent graphs as a set of vertices (V) and a set of edges (E).

Problem: This is quite slow for certain tasks e.g. finding what vertices a given vertex has an edge to
Solution: We have other ways of representing graphs

Adjacency Matrix

We have an matrix where iff there is an edge .
Otherwise, .

Adjacency List

Linked List for each node in the graph, which contains the nodes connected to the original node.

![Note]- Time/Space Complexities
Space is

Graph Search (unweighted)

BFS

Theorem: we have that consists of nodes at a distance from .

BFS Time Complexity

Dijkstra’s

Dijkstra Proof

Note that is the length of a single step. is the length of the path so far (defined for all explored points so far)