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.

Set orientation: 'UNDIRECTED' for multiple Relationships

I am using ShortestPath algorithm. I have several Relationships for which I want to ignore their direction, and I'm not using any costs.
I can specify orientation: 'UNDIRECTED' for each Relationship, but I have to create a list of dictionaries. It becomes a bit cumbersome as the number of different Relationships grows:

 relationshipProjection: {
    SELLS: {
      type: 'SELLS',
      orientation: 'UNDIRECTED'},
    PURCHASES: {
      type: 'PURCHASES',
      orientation: 'UNDIRECTED'},
    IS_PART_OF: {
      type: 'IS_PART_OF',
      orientation: 'UNDIRECTED'},
....
  }

I wonder if there is a way to specify orientation: 'UNDIRECTED' in one place for all Relationships, with the Relationships specified as a simple list:

relationshipProjection: ['SELLS','PURCHASES','IS_PART_OF',...],

?

Thank you

1 REPLY 1

Bennu
Graph Fellow

Hi @davidmakovoz,

I think there's no way to do it like you want it, so far. Have you consider wraping the call in a user defined procedure?

Whenever I'm cornered like this I prefer writing my own procedure/function that builds the parameters for function of another library. This may be useful if you wanna try:

https://neo4j.com/docs/java-reference/current/extending-neo4j/procedures-and-functions/procedures/

H