Neo4j path returned with falsely alternating relationship directions in cypher-shell

Threats to understanding the direction of relations in the return paths.

I have such a graph

(:START)-[:NEXT]->(:NODE)-[:NEXT]->(:NODE)...

Now I map all the paths, starting from the beginning of the node in the direction :NEXTup to length 10, say. The request looks like

MATCH t=((:START)-[:NEXT*..10]->(:NODE))
RETURN t;

I get weekend paths with seemingly mixed directions :NEXT, such as

(:START)-[:NEXT]->(:NODE)<-[:NEXT]-(:NODE)-[:NEXT]->(:NODE)<-...

and I can’t understand where the variable directions come from.

EDIT: A graph is just a straight line (with one direction). No loops, no branches. Repeat the script in the shell as follows:

CREATE (s:START);
MATCH (s:START) MERGE (s)-[:NEXT]->(a:NODE)-[:NEXT]->(b:NODE)-[:NEXT]->(c:NODE)-[:NEXT]->(d:NODE);
MATCH t=((:START)-[:NEXT*..10]->()) return t;

+------------------------------------------------------------------------------+
| t                                                                            |
+------------------------------------------------------------------------------+
| (:START)-[:NEXT]->(:NODE)                                                    |
| (:START)-[:NEXT]->(:NODE)<-[:NEXT]-(:NODE)                                   |
| (:START)-[:NEXT]->(:NODE)<-[:NEXT]-(:NODE)-[:NEXT]->(:NODE)                  |
| (:START)-[:NEXT]->(:NODE)<-[:NEXT]-(:NODE)-[:NEXT]->(:NODE)<-[:NEXT]-(:NODE) |
+------------------------------------------------------------------------------+

See how on the returned paths the arrows alternate in the direction? It scares me.

+4
source share
1

:

EDIT: - ( ). , . :

cypher-shell . , . Github cypher-shell . issue.

2:

, Github, commit. , .

3

​​ this commit.


:

. :

:

CREATE (node1:Node {id:1})
CREATE (node2:Node {id:2})
CREATE (node3:Node {id:3})
CREATE (node4:Node {id:4})
CREATE (node1)-[:NEXT]->(node2)
CREATE (node2)-[:NEXT]->(node3)
CREATE (node3)-[:NEXT]->(node4)
CREATE (node4)-[:NEXT]->(node2)

MATCH t=((:Node {id:1})-[:NEXT*..10]->(:Node {id:4}))
RETURN t;

:

Result 1

( ) (:Node {id:4})-[:NEXT]->(:Node {id:2}). , Neo4j " " . Neo4j. :

Settings

" " :

Result 2

, " " . : (:Node {id:4}) (:Node {id:2}) , "", "" "".

+2

Source: https://habr.com/ru/post/1682402/


All Articles