Original link:tecdat.cn/?p=7598

Original source:Tuo End number according to the tribe public number

Here’s how to create a chart, detect the community in it, and then visualize it in Python with nodes colored by their community in less than 10 lines:

import networkx as nx
import community

G = nx.random_graphs.powerlaw_cluster_graph(300, 1, .4)

part = community.best_partition(G)
values = [part.get(node) for node in G.nodes()]
Copy the code

Modularity is easy to implement:


mod = community.modularity(part,G)
print("modularity:", mod)
Copy the code
 
Copy the code

Modularity: 0.8700238252368541 is given.


Most welcome insight

1. Dynamic map visualization in R language: how to create beautifully animated graphs

2. Visual analysis of R language survival analysis

3.Python Data Visualization – Seaborn Iris Iris data

4. R language for buffon needle throwing (Buffon needle throwing) experiment simulation and dynamic

5. Visualization case of R language survival analysis data analysis

6. R language data visualization analysis case: Explore BRFSS data data analysis

7. Dynamic visualization in R language: make animated GIF video images of cumulative dynamic line charts of historical global average temperature

8. Case report of principal component Pca and T-SNE algorithm dimension reduction and visual analysis for R language high-dimensional data

9. Python topics LDA modeling and T-SNE visualization