Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-17-2022 11:21 AM
Hi!
Is there any way to obtain a cypher projection on GDS but starting from a custom node? And then run an algorithm over that subgraph?
I would like to obtain the cypher projection starting from, let's say, Node-A, expand to 'n' hops (specifying the relationships) and then run any algorithm (pagerank for example).
I was thinking on this kind of query inside gds.graph.create.cypher
:
MATCH (n:Node {id:'12345'})-[:REL*1..5]-(m) RETURN id(n) AS source, id(m) AS target
But I am not pretty sure about how to put the intermediate relationships (relationships between the other nodes while traversing the graph)
Here is an image of how I visualize it.
Thanks in advance
01-18-2022 06:20 AM
Hi @diego.ulloa13 ,
Have you tried something like :
CALL gds.graph.create.cypher(
'test',
'MATCH (n:Node {id:'12345'})-[:REL*0..5]-(m) with distinct m return id(m) as id',
'MATCH p = (n:Node {id:'12345'})-[:REL*1..5]-(m) UNWIND relationships(p) as r WITH distinct r return id(startNode(r)) as source, id(endNode(r)) as target')
YIELD
graphName AS graph, nodeQuery, nodeCount AS nodes, relationshipQuery, relationshipCount AS rels
Bennu
All the sessions of the conference are now available online