Testing for Unconnected Components in an Undirected Graph
With a graph structure it is possible that parts of the graph will not be connected to each other. An example of this would be with social networks, not all users are friends with other users.
The code will find the total number of connected components of the graph, or graph parts in an undirected graph.
See code below.