Clustering Methods and Community Detection with NetworkX. A slide deck for the NTU Complexity Science Winter School.
For the accompanying iPython Notebook, visit: http://github.com/eflegara/NetStruc
2. Walkthrough
• Network structure and function
• Communities
• Community detection algorithms
• Divisive
• Agglomeratxive
• Application: Community detection in framing analysis
• Hands-on http://tiny.cc/commdet2017
http://tinyurl.com/commdet2017
3. Network Structure
• Path length
• Diameter
• Clustering coefficient
• Degree distribution
• Centrality measures
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
What would the behaviour of
networked systems be based on their
structural properties?
Structure Func*on
4. Communities
• Cluster, module, group
• A group of nodes that have a
higher likelihood of connecting
to each other than to nodes
from other communities
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
5. Example of Communities
• Network: World Wide Web
• Communities: Sites on related topics
• Network: Friendship network
• Communities: Group formation among people
• Network: Metabolic networks
• Communities: Functional modules
• Network: Collaboration network
• Communities: Research fields
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
6. Social Networks: Politics, Ideologies
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
The political blogosphere and the 2004 U.S. election:
divided they blog
by Lada Adamic, Natalie Glance
Social media, political change and the #RapplerDebate
by Maria A. Ressa and Russell Shepherd
7. How does one find the
Communities?
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
10. Modularity
• Measure the quality of a partition
“the fraction of edges that fall within communities, minus the
expected value of the same quantity if edges fall at random
without regard for the community structure”
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
Mc =
ncX
c=1
"
Lc
L
✓
kc
2L
◆2
#
15. 1 2
3
Mc = 0.50
M = 0
1 2
3
Mc = 0.35
Optimal Partition Suboptimal Partition
One Community
Modularity
Mc =
ncX
c=1
"
Lc
L
✓
kc
2L
◆2
#
Community Structures | EF Legara | 2017 NTU Winter School on Complexity Science
16. Quantifying Community Structures
Divisive
• Girvan-Newman Algorithm (edge betweenness)
Agglomerative
• Hierarchical clustering (distance matrix)
• Louvain Method (modularity-maximization)
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
Cut 3 classes
Cut 4 classes
Cut 6 classes
17. Community Detection in Framing Analysis
Framing - the “central organizing idea for
making sense of an issue or conflict and
suggesting what is at stake”
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
EF Legara, C Monterola, C David, and JM Atun, "News Framing of
Population and Family Planning Issues via Syntactic Network
Analysis", Intl J of Mod Phys C 21, Issue: 1, pp. 51-65 (2010).
A Network of Words
18. “Frames have been shown experimentally to cause differences
in attributions of responsibility among readers or audiences.”
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
19. • 346 news articles (randomly sampled)
• Population, family planning, reproductive health, and
contraception published between 1987 and 2007
Framing in the News
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science
20. Every article assigned to
a single dominant frame
q Population and Development
q Family Planning as Conflict between
Government and Church
q Women’s and Reproductive Health
q Population Management Threatens
Morals and Values
q Population Growth and
Demographic Trends
q Others
Community Structures | EF Legara | 2016 NTU Winter School on Complexity Science