liveBook · Manning

Co-occurrence network

As explained in Graph Algorithms for Data Science

A hashtag co-occurrence network is a graph whose nodes are hashtags and whose relationships represent hashtags occurring together in observed content.

A co-occurrence network turns entities found together in content into a graph. In a hashtag network, each Tag is a node and a connection means two hashtags appeared in the same tweet. Connections can reveal useful tag combinations, topic clusters, and less obvious hashtags beyond the most frequent ones. section 7.0

Figure 7.5 Constructing a co-occurrence network of tags based on whether they co-occur in the same tweet
07-05

This construction view makes the projection clear: tweets link to their hashtags first, then hashtags that share a tweet become connected. section 7.0

Build a hashtag co-occurrence network in practical steps:

  • Extract hashtags from original tweets, excluding retweets so repeated content does not skew counts. Normalize tags, create Tag nodes, and connect each Tweet to its tags with HAS_TAG relationships. section 7.1
  • Match two Tag nodes attached to the same tweet. Keep one ordering of each pair, such as id(h1) < id(h2), to avoid returning the same pair twice. section 7.2
  • Use the number of shared tweets as a relationship weight. Treat the conceptual connection as undirected; in GDS, represent it with opposing directed relationships when traversal in both directions is needed. section 7.2
  • Alternatively, infer relationships with node similarity. Jaccard similarity compares the tweets associated with two hashtags, while similarityCutoff and topK control which relationships remain. section 7.2.2

Reading a weighted hashtag pair

The pair #ai and #nlp co-occurs in 1,507 tweets in the sample, so its connection can carry a weight of 1,507. High counts identify commonly paired tags, but a similarity-based projection can instead emphasize overlap relative to each tag’s broader tweet set. section 7.2 section 7.2.1

Network density shapes the interpretation. Raising topK gives each hashtag more similar neighbors, while raising similarityCutoff removes weaker links; broader networks can produce broader communities. Analyze the resulting Tag-only network with degree centrality, label propagation, and PageRank to inspect connected tags, communities, and community representatives. section 7.2.2 section 7.4 section 7.5

How Graph Algorithms for Data Science covers it

How deep it goes
Walks through extraction, Cypher construction, weighting, similarity-based inference, density tuning, and community analysis.
Examples
Uses tweets and hashtags, including #ai–#nlp pairs, alongside keyword, character, ingredient, and product-basket networks.
What it assumes
Teaches elementary hashtag extraction and Cypher list handling from stored Tweet text.
What you can do after
Apply it via Cypher and Neo4j Graph Data Science to infer hashtag networks and inspect their communities.
How it connects
Connects bipartite networks, Jaccard similarity, node similarity, degree centrality, label propagation, and PageRank.

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.