In order to learn about the graph structure, a first common step is to identify graph components, or independent sub-graphs. To do so, we are going to use the WCC algorithm from the GDS.
In this example, we will use an anonymous projected graph:
CALL gds.wcc.write({
nodeProjection: "User",
relationshipProjection: {
FOLLOWS: {
type: "FOLLOWS",
orientation: "UNDIRECTED",
aggregation: "SINGLE"
}
},
writeProperty: "wcc"
})
This procedure does all of the following:
- Runs the WCC algorithm.
- Writes the results back to the graph by adding a property called wcc to each node.
- Uses all nodes with the User label and all relationships with the FOLLOWS type, ignoring the relationship direction and taking into account one single edge between two identical nodes – if A follows B and B follows A and the graph is undirected, we would have two edges between A and B, adding the aggregation. The...