Weights on Relationships

Hello,

I have two questions when it comes to weighted relationships and the application of the graph data science(GDS) library in Neo4j:

  1. Is it a requirement to absolutely have weights on the relationships between nodes before going on to use the graph algorithms in the GDS library? I have managed to execute some graph algorithms on unweighted relationships, but I'm not sure how meaningful these results are. It seems like every tutorial I've done on the GDS library has been on a graph with weighted relationships.

  2. Does the property name stored on the relationship containing the weight value have to be called "weight" so that it's picked up by the graph algorithm? Or can this property name be called something else like "number of sales" or "number of calls" for instance and then be treated as the weight value when running the GDS algorithm?

Thank you.

Hello @carib,

(1) It is not a requirement to have relationship weights for any algorithms. You can see them as additional information to be used by the algorithms. Often it can signal which relationships are more important than others. If you dont have any weights, all relationships will impact the result equally. Further, on the top of each algorithm page we list the traits an algorithm supports. In our current preview version we improved on them. Such as in Triangle Count - Neo4j Graph Data Science you can see that the weighted trait changed from not supported to allowed.

(2) The relationship property can be named however you want. When calling the algorithm you need to specify the relationshipWeightPropertyparamter if you want to use the a certain rel property as weights for the algo.
This is useful if you project multiple properties and than for different algorithms you can use different properties.

Hope this answers you questions