neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

String RelationshipWithPropertyConsumer #278

Closed vadyushkins closed 10 months ago

vadyushkins commented 10 months ago

Hi there!

First of all, awesome repository, thank you very much for your work!

After spending some time studying the source code, I still couldn't figure out how to solve the following problem.

Problem. For a given graph node, find all outgoing relationships with the given edge string label relationship property.

Unfortunately, I managed to find only double values of relationship properties. I mean https://github.com/neo4j/graph-data-science/blob/bede03e84eb363de547a0c29faf7193df8f75b98/core/src/main/java/org/neo4j/gds/api/RelationshipWithPropertyConsumer.java#L22

Please help me figure out how to get string relationships in a graph.

vnickolov commented 10 months ago

Hi @vadyushkins,

Thank you for the kind words!

Your finding is correct, the library does not support string property values, for both relationship properties and node properties. For relationship properties the currently support double values, node properties have more flexible types which can be found here: https://neo4j.com/docs/graph-data-science/current/management-ops/node-properties/

In general the library works with numerical values. One possible solution for your issue is to do some pre-processing and assign numerical value to the string relationship property and use that value when projecting the graph.

I hope this helps. Regards, Veselin

FlorentinD commented 10 months ago

In the preview docs, we improved the documentation about our supported graph model (see https://neo4j.com/docs/graph-data-science/2.5-preview/management-ops/graph-creation/#_graph_data_model).

Could you describe what you plan to do with string relationship properties?

vnickolov commented 10 months ago

@vadyushkins I am going to close this issue due to being inactive, I hope the explanations helped. Please feel free to open a new one if you need more details or would like to propose new feature for the library.