To implement the previously discussed pseudo code, we will first simplify our data a little bit. There are two ways to do this, as follows:
- Create an adjacency matrix of the graph data that indicates the graph as a two-dimensional array of size m x m, which consists of 1s and 0s. 1s indicates a connection between the mrow node with mcolumn and 0s indicates no connection.
- We simplify the dataset and only extract the nodes as a map in which the key is the node and the value is the list of nodes that it is connected to.
Although both approaches are fine ways of approaching the problem, the first option is usually preferred and is popular because the second option is of a higher code complexity because of all the overhead of ...