input: Write a python function to find the connected components of a given graph using the networkx library.
  assert len(connected_components(nx.Graph([(1, 2), (2, 3), (4, 5)]))) == 2
  assert len(connected_components(nx.Graph([(1, 2), (2, 3), (3, 4), (4, 5)]))) == 1
  assert len(connected_components(nx.Graph([(1, 2), (2, 3), (4, 5), (6, 7), (7, 8)]))) == 3
output: import networkx as nx
  
  def connected_components(graph):
      return list(nx.connected_components(graph))