liveBook · Manning

Weakly connected component

As explained in Knowledge Graphs and LLMs in Action

A weakly connected component is a maximal set of vertices in a directed graph that remains connected when edge directions are ignored.

A weakly connected component (WCC) is a maximal group of vertices that remains connected when edge directions are ignored. In a knowledge graph, it reveals disconnected subgraphs and provides a first structural quality check. section 4.2.2 section 4.5

A practical Neo4j workflow is:

  • Mark relevant nodes, such as proteins participating in INTERACTS_WITH relationships. section 4.2.2
  • Create an in-memory graph projection and treat the interaction relationship as undirected. section 4.2.2
  • Run gds.wcc.write and store each node’s componentId, together with component counts and distribution statistics. section 4.2.2
  • Use Louvain instead when the goal is to find densely connected communities within a single connected component. section 4.2.2

PPI network inspection

A protein–protein interaction graph containing 21,559 proteins produced 27 WCCs: one component contained 21,521 proteins, while the remaining components were single nodes or small islands of up to four proteins. In entity resolution, WCCs similarly group connected person mentions in a META_PERSONS_SIMILAR metagraph before assigning a common representative name. section 4.2.2 section 6.1.4

Listing 4.9 Running the WCC on the PPI network
CALL gds.wcc.write('ppi-graph', { writeProperty: 'componentId' })
YIELD nodePropertiesWritten, componentCount, componentDistribution;

The runnable GDS procedure writes component identifiers and returns counts and distribution statistics for the projected graph. section 4.2.2

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains projection, execution, stored identifiers, and distribution interpretation; defers dense community discovery to Louvain.
Examples
Uses a protein–protein interaction network and a person-mention similarity metagraph as concrete applications.
What it assumes
Assumes a labeled Neo4j graph and relationships, then demonstrates projection and connectivity analysis operationally.
What you can do after
Apply it via Neo4j GDS to write component identifiers and inspect component distributions.
How it connects
Connects graph projection, Neo4j GDS, Louvain, entity resolution, and knowledge-graph quality evaluation.

Also explained in

Compare how 2 books explain weakly connected component →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.