April 2019
Beginner
190 pages
4h 54m
English
The same community detection algorithm can be used on much larger networks, such as online social networks. The following example uses a social network constructed from combining the online social networks of 10 individuals (McAuley & Leskovec, 2012). The following code loads and visualizes the network:
# Load data file into networkfrom pathlib import Pathdata_dir = Path('.') / 'data'G_social = nx.read_edgelist( data_dir / 'mcauley2012' / 'facebook_combined.txt')# Calculate layout and drawpos = nx.spring_layout(G_social, k=0.1)nx.draw_networkx( G_social, pos=pos, node_size=0, edge_color="#333333", alpha=0.05, with_labels=False)
Using a spring layout and drawing only edges, the preceding code produces the following ...
Read now
Unlock full access