liveBook · Manning

Community detection

As explained in Graph Algorithms for Data Science

Community detection is a family of graph algorithms that identifies densely interconnected groups of nodes.

Community detection, also called clustering, identifies communities in a graph: densely interconnected groups of nodes whose members have comparatively fewer connections to other groups. A friendship group is a useful model: its members interact often, while an occasional connection to someone outside the group does not make that person part of the group. section 1.1 section 5.1

Figure 5.3 Friendship network with nodes with outlined communities
05-03

The outlined groups make the main idea visible: dense ties within each group distinguish a community from a single link between otherwise separate friend groups. section 5.1

The technique helps reveal graph structure that is hard to extract from a visualization alone, especially as a network grows. Its results can expose disconnected and isolated nodes as well as multiple highly connected groups in the main graph. These groups can support friendship or content recommendations, user segmentation, and network characterization. section 1.1 section 1.3

Follower network

In a social network, nodes represent users and relationships represent follows or other interactions. Community detection can find tightly connected groups of users. In a small friendship network, Frodo, Samwise, and Jack form a community because each is connected to the others; Jack’s tie to Ganesh alone does not place Ganesh in that community, because Ganesh lacks ties to the rest of the group. section 1.1 section 5.1

Community detection is one category of graph algorithm, alongside centrality algorithms, which identify influential nodes. Algorithm output can also become input to machine-learning workflows for predicting links or classifying data points. The task begins with a graph model: entities become nodes and their connections become relationships. section 1.3 section 2.0

Prepare the graph shape before running a community detection algorithm:

  • Recognize that many centrality and community detection algorithms expect a graph with one node type and one relationship type. section 2.0
  • Transform graphs with multiple node or relationship types into the shape expected by the algorithm rather than changing the algorithm to fit the data. section 2.0
  • Use graph query languages or built-in database tools to carry out the required transformations; data wrangling is a substantial part of graph analytics work. section 2.0

For network analysis, Cypher and the Neo4j Graph Data Science library can be used with community detection and centrality algorithms. Alongside measures such as node and relationship counts, connected-component sizes, and average local clustering coefficient, detected communities help characterize how a network is organized. section 5.1

How Graph Algorithms for Data Science covers it

How deep it goes
Defines communities through social-network examples and explains required graph-shape transformations, without detailing a particular algorithm's mechanics.
Examples
Uses social-platform followers and an eight-person friendship network with outlined communities.
What it assumes
Teaches the graph-input shape needed by algorithms while relying on nodes, relationships, and Cypher for network analysis.
What you can do after
Apply it via Neo4j Graph Data Science library to characterize networks and find tightly connected user groups.
How it connects
Connects community detection with graph modeling, centrality, data wrangling, Cypher, and machine-learning workflows.

Also explained in

Compare how 4 books explain community detection →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.