G_reply = G_reply.subgraph(rand_smpl) G_mention = G_mention.subgraph(rand_smpl) G_retweet = G_retweet.subgraph(rand_smpl) G_social = G_social.subgraph(rand_smpl) c = list(nx.k_clique_communities(G_social, 6)) print len(c) mainpart = community.best_partition(G_social) print len(mainpart.values()) for commcnt in range(len(c)): nodeset = list(c[commcnt]) Gr = G_reply.subgraph(nodeset) Gm = G_mention.subgraph(nodeset) Grr = G_retweet.subgraph(nodeset) Gs = G_social.subgraph(nodeset) #if (nx.is_connected(Gr) and nx.is_connected(Gm) and nx.is_connected(Grr) and nx.is_connected(Gs)): # pass #else: # print 'Runtime error, one of the graphs is not connected' # continue Garr = [Gr, Gm, Grr, Gs] Klist = sg.multiview_IRWK(Garr) for K in Klist: print K print 'average similarity is:', K.mean() stop = timeit.default_timer() print stop - start