10-19 Connected

Write a function to find the number of connected components in a graph.

def connected_components(g: Graph) -> int:
    return -1 # skeleton

Follow the design process to make it go more smoothly.

Testing your code

You should make some simple examples before you get complicated with your testing.

I have some code to show the distribution of number of components in a random graph with 100 edges and 120 vertices.