KWriter
KWriter

Reputation: 1180

How do you define direction of relationship using GQLAlchemy and can it be undirected/bidirectional?

When I write Cypher query, I can set the direction of the relationship:

CREATE (:Country {name: 'France'})<-[l:WORKING_IN]-(p)-[w:LIVING_IN]->(:Country {name: 'Germany'})

I know that with GQLAlchemy I need to use the methods to() and from() after create(). I suppose that this sets the direction of the relationship.

But is it possible to create an undirected/bidirectional relationship?

Upvotes: 0

Views: 149

Answers (1)

KateLatte
KateLatte

Reputation: 728

It is not possible to create a bidirectional relationship, because bidirectional relationships are not supported when creating a relationship. In Memgraph, it is only possible to create directed relationships. If you are doing some kind of matching with the bidirectional pattern such as:

MATCH (:Country {name: 'France'})-[l:WORKING_IN]-(p)-[w:LIVING_IN]-(:Country {name: 'Germany'})

Memgraph is actually looking for both -> and <- relationships, that is, both in and out relationships.

Upvotes: 1

Related Questions