Let's start with the question *what is a graph?* Broadly speaking, a graph is a data structure that consists of **nodes** (also called **vertices**) and **edges**. Each edge connects two nodes. A graph data structure does not require any specific rules regarding connections between nodes, as shown in the following diagram:

The afore mentioned concept seems very simple, doesn't it? Let's try to analyze the preceding graph to eliminate any doubts. It contains nine nodes with numbers between **1** and **9** as values. Such nodes are connected by 11 edges, such as between nodes **2** and **4**. Moreover, a graph can contain **cycles**, for example, with nodes ...