how to reduce the time complexity?


I have a graph G=(V+E) and list of list Node where each sublist is subset of V. I want to find out nodes of each sublist that are not reachable from other nodes of that sublist and add edge between those nodes. Suppose,Node=[[1,2,3,4,5,7,8],[9,10],….] and in sublist=[1,2,3,4,5,7,8], {1,7,3,8} reachable from each other and {2,4,5} reachable from each other so an edge needs to be added between 1/7/3/8 and 2/4/5. I have used the following :

for each sublist in Node  SG=node_induced_subgraph(sublist) of G  C=connected_components(SG)   for each component c_i in C   add edge between c_i and c_{i+1}  end end 

complexity of node_induced_subgraph() is O(V+E) complexity of connected_components() is O(m+n) # m is no. of nodes and n is no. of edges in Sub-graph

So how to reduce the overall complexity?