Query to get Cycles for a node in a graph returns no output

95 views
Skip to first unread message

Pushkar Nagpal

unread,
Jun 20, 2019, 11:48:45 PM6/20/19
to openCypher
I am trying to get cycles for a node and setting a limit to cycle size but it returns no output while the same query works perfectly fine in neo4j-Cypher

Query: 
match (n:account) where n.node_id='1055' match p = (n)-[*..5]->(n) return p

This query should return paths of the cycles.

Mats Rydberg

unread,
Jun 26, 2019, 9:54:40 AM6/26/19
to openCypher
Hello Pushkar and thanks for reaching out to us

You're saying that in Neo4j, this query is doing what you expect of it? Then I wonder, where are you executing with a different behaviour? What implementation of Cypher are you using?

Regards
Mats

Pushkar Nagpal

unread,
Jul 12, 2019, 9:40:51 AM7/12/19
to openCypher
Hi Mats,

Thanks for replying!

I am using  openCypher-for-gremlin (https://github.com/opencypher/cypher-for-gremlin) and this query isn't returning any outputs for me, though I was able to create an alternate query to get cycles in the data which works efficiently:
 
match (m1:account{node_id:'1055'})-[t]->(m2:account) match cyclePath=(m2)-[*..4]->(m1) RETURN m1, t, nodes(cyclePath),relationships(cyclePath) as cycle

The following query returned me cycles for the specified node.

Mats Rydberg

unread,
Jul 19, 2019, 3:56:43 AM7/19/19
to openCypher
Hello Pushkar

Interesting! I can't determine that there is anything wrong in your query. I would expect the two versions you've tried to both find the same sort of cycles. I think it would be good if you would report this issue on the Cypher For Gremlin repository, because it may be a bug (unless I'm missing some detail).

Happy to hear that you were able to work around it.

Regards
Mats
Reply all
Reply to author
Forward
0 new messages