<aside> <img src="/icons/help-alternate_gray.svg" alt="/icons/help-alternate_gray.svg" width="40px" /> Most, if not all, of the topics covered in this lecture are pretty much recap of what we covered in COE428. For reference: COE428 - Algorithms and Data Structures — most of which will be copy-pasted in here.

</aside>

Basic Definition and Applications

A graph $G$ is a pair $(V,E)$ where the element of $V$ are called vertices and the element of $E$ are called edges. The number of vertices is denoted by $n = |V|$ and edges by $m = |E|$.

Figure 2.1 Example of a graph.

Figure 2.1 Example of a graph.

Consider the graph in Figure 2.1. The graph has the following vertices and edges:

A graph can be categorized into one of two types depending on the edge type:

  1. Undirected graph: Edges do not have a direction — undirected edge are unordered pair of vertices, such that $(u,v)$ and $(v,u)$ are the same edge.

Figure 2.2a Undirected graph.

Figure 2.2a Undirected graph.

  1. Directed graph: Edges with direction — directed edges are ordered pair of vertices, such that $\langle u,v \rangle$ and $\langle v,u \rangle$ are two different edges.

    Figure 2.2b Directed graph.

    Figure 2.2b Directed graph.

Representation of Graphs

We can choose between two standard ways to represent a graph $G = (V,E)$.

Paths and Connectivity

We will go over a few graph terminologies, some of which you should be familiar with.