'Is there any way to mutate the property on relationship which is already exist on node?

I am using neo4j GDS library and wondering is there any way I can mutate a property on the relationship which is already exist on the node. e.g. I have nodes with label Person connected nodes Book using relationship read. I am using the Page Rank algorithm which gives me expected output but I want to use weighted algorithm and wants to use the property Price on the Book. As per my document I could find that I can use the weight on the relationship using "relationshipWeightProperty" but couldn't find anything related to node. So is there any way I can use the weight from the target nodes property or is there any way I can mutate the price property on the relationship from the node and then use it?



Solution 1:[1]

So there are a couple of things...

  1. PageRank does not support node weights, so there is no option to use that.

  2. You can either use Cypher Projection to project the node weight as the relationship property without having to transform the underlying stored graph.

  3. You can create a relationship weight in the database and use Native Projection to project the newly created relationship weight (along with other information)

Edit:

First you need to add the node property to the relationships with cypher.

MATCH (i:Instrument)<-[l:LIKES]-()
SET l.score = i.score

And then run the above projection query.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1