Do not add peers to graph if they have not been processed

This commit is contained in:
Thomas Wade 2018-09-29 13:29:38 +09:30
parent bb88bbeb24
commit 717d7ae6c0

View File

@ -430,20 +430,28 @@ for _, user in user_dict.items():
) )
print(' Followers:') print(' Followers:')
for follower in user.followers: for follower in user.followers:
print(' ' + str(follower)) if follower in user_dict.keys():
graph.add_edge( \ if not user_dict[follower].processed:
follower, \ continue
user.url_username, \
label='follows' print(' ' + str(follower))
) graph.add_edge( \
follower, \
user.url_username, \
label='follows'
)
print(' Following:') print(' Following:')
for following in user.following: for following in user.following:
print(' ' + str(following)) if following in user_dict.keys():
graph.add_edge( \ if not user_dict[following].processed:
user.url_username, \ continue
following, \
label='follows' print(' ' + str(following))
) graph.add_edge( \
user.url_username, \
following, \
label='follows'
)
print('Making graph...') print('Making graph...')
nx.write_gexf(graph, 'graph.gexf') nx.write_gexf(graph, 'graph.gexf')