cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Calculate cloness centrality with Graph Database Service on all nodes and relationships

Hi all !
I try to run a closness centrality algorithm with the gds plug-in but I can't figure out how to make the query.
I have understood that the query needs a node and relationship projection to be run.
I have good results with this query for SYSTEM_VARIABLE nodes linked with STRUCTURAL_AND_OPERATIONAL_DEPENDENCY relationship:

CALL gds.alpha.closeness.stream({
  nodeProjection: 'SYSTEM_VARIABLE',
  relationshipProjection: 'STRUCTURAL_AND_OPERATIONAL_DEPENDENCY'
})
YIELD nodeId, centrality
RETURN gds.util.asNode(nodeId).name AS user, centrality
ORDER BY centrality DESC

But now I would like to perform this algorithm on all my nodes, whatever the relationships are.
How can I specify "all nodes" and "all relationship" in these projections ?
Thanks for your help.

1 ACCEPTED SOLUTION

You can use the * syntax to specify all nodes and all relationships:

CALL gds.alpha.closeness.stream({
  nodeProjection: '*',
  relationshipProjection: '*'
})
YIELD nodeId, centrality
RETURN gds.util.asNode(nodeId).name AS user, centrality
ORDER BY centrality DESC

View solution in original post

2 REPLIES 2

You can use the * syntax to specify all nodes and all relationships:

CALL gds.alpha.closeness.stream({
  nodeProjection: '*',
  relationshipProjection: '*'
})
YIELD nodeId, centrality
RETURN gds.util.asNode(nodeId).name AS user, centrality
ORDER BY centrality DESC

Thanks Alicia ! It's perfect