We could create a named projected graph using the same parameters as in the previous section:
nodeProjection: "User",
relationshipProjection: {
FOLLOWS: {
type: "FOLLOWS",
orientation: "UNDIRECTED",
aggregation: "SINGLE"
}
}
However, we know that our graph contains several disconnected components and that running the PageRank algorithm on such a graph may lead to surprising results. In order to avoid that, we will run our two algorithms only on the biggest component identified with the WCC algorithm. This selection has to be achieved through a Cypher query. After you have identified the value of the wcc property for the community with the highest number of users, you can use the following:
CALL gds.graph.create.cypher(
"graph",
"MATCH (u:User) WHERE u.wcc = 1 AND v.wcc = 1 RETURN id(u) as id",
"MATCH (u:User)-[:FOLLOWS]-(v:User) RETURN id(u) as source, id(v) as target"
)