The simplest way to define a graph would be anything that is a collection of nodes in which the nodes are connected by edges. Graphs are one of the most popular mathematical concepts that are used in computer science. Popular examples of graph implementations would be any social media website these days. Facebook use friends as nodes and friendship as edges; Twitter, on the other hand, defines followers as nodes and following as an edge, and so on. Take a look at the following image:
In the preceding image, you can see a typical graph with nodes and edges. As you can note, there are no directions listed out to our edges, and there are no details mentioned on our nodes. This is because there are different types of graphs, and the nodes and edges vary slightly between these different types of graphs, which we will see in the...