# print "Num Edges - "+str(nx.number_of_edges(original)) #print "Center of the graph "+str(nx.center(G_)) # print "Eccentricity - "+str(nx.diameter(original)) # print "Radius - "+str(nx.radius(original)) if ground_truth == 0: partition_ground_truth = community.best_partition( nx.Graph(original)) snapshotCommunities( args.input_directory_stem + 'output-prefix.t0000' + str(i), partition_ground_truth) partition_set = se.ReadInData(args.input_directory_stem + 'output-prefix.t0000' + str(i) + '.comms') partition_ground_truth = se.partitionFromFile( args.input_directory_stem + 'output-prefix.t0000' + str(i) + '.comms', ' ') print "Modularity - " + str( community.modularity(partition_ground_truth, original)) #draw graph # count = 0 # pos = nx.spring_layout(original) # colors = ['#660066' ,'#eeb111' ,'#4bec13' ,'#d1d1d1' ,'#a3a3a3' ,'#c39797' ,'#a35f0c' ,'#5f0ca3' ,'#140ca3' ,'#a30c50' ,'#a30c50' ,'#0ca35f' ,'#bad8eb' ,'#ffe5a9' ,'#f5821f' ,'#00c060' ,'#00c0c0' ,'#b0e0e6' ,'#999999' ,'#ffb6c1' ,'#6897bb'] # for com in set(partition_ground_truth.values()) : # count = count + 1 # list_nodes = [nodes for nodes in partition_ground_truth.keys() if partition_ground_truth[nodes] == com] # nx.draw_networkx_nodes(original, pos, list_nodes, node_color = colors[count-1])
# numNodes = len(nx.nodes(original)) # print "For Original Network" # print "Num Edges - "+str(nx.number_of_edges(original)) #print "Center of the graph "+str(nx.center(G_)) # print "Eccentricity - "+str(nx.diameter(original)) # print "Radius - "+str(nx.radius(original)) if ground_truth == 0: partition_ground_truth = community.best_partition( nx.Graph(original)) else: partition_set = se.ReadInData('original_snapshot/' + 'output-prefix.t0000' + str(i) + '.comms') partition_ground_truth = se.partitionFromFile( 'original_snapshot/' + 'output-prefix.t0000' + str(i) + '.comms', ' ') print "Modularity - " + str( community.modularity(partition_ground_truth, original)) #draw graph #============================================================================== # count = 0 # pos = nx.spring_layout(original) # colors = ['#660066' ,'#eeb111' ,'#4bec13' ,'#d1d1d1' ,'#a3a3a3' ,'#c39797' ,'#a35f0c' ,'#5f0ca3' ,'#140ca3' ,'#a30c50' ,'#a30c50' ,'#0ca35f' ,'#bad8eb' ,'#ffe5a9' ,'#f5821f' ,'#00c060' ,'#00c0c0' ,'#b0e0e6' ,'#999999' ,'#ffb6c1' ,'#6897bb'] # for com in set(partition.values()) : # count = count + 1 # list_nodes = [nodes for nodes in partition.keys() if partition[nodes] == com] # nx.draw_networkx_nodes(original, pos, list_nodes, node_color = colors[count-1]) #