Graphs
Chapter 8, Exploring Graphs, was related to graphs – a very popular data structure with a broad range of applications. As a reminder, a graph is a data structure that consists of nodes and edges. Each edge connects two nodes. There are a few variants of edges in a graph, such as undirected and directed, as well as unweighted and weighted. A graph can be represented as an adjacency list or as an adjacency matrix.
All of these topics were described in the book, together with the problem of graph traversal with breadth-first search and depth-first search algorithms, finding the minimum spanning tree with Kruskal’s and Prim’s algorithms, node coloring, and finding the shortest path in a graph with Dijkstra’s algorithm.
The exemplary graphs are shown in the following illustration:
Figure 10.12 – Illustration of graphs
A graph data structure is commonly used in various applications. It is also a great way to represent...