5 - Graph Algorithms#

These graph algorithms are covered in Chapter 22 of the textbook.

A graph is a set of vertices and edges.

  • Edges may be directed or undirected.

  • Edges may have weight.

There are 2 main ways to represent a graph:

  • An adjacency-list representation is an array of size \(n\), where \(n\) is the number of vertices in the graph. Each item in the array is a list of the vertices connected to that vertex by an edge.

  • An adjacency matrix represents the connections between vertices in a graph.