Project graph from Neo4j with GraphDataScience Python library

So I have a graph of nodes -- "Papers" and relationships -- "Citations".
Nodes have properties: "x", a list with 0/1 entries corresponding to whether a word is present in the paper or not, and "y" an integer label (one of the classes from 0-6).

I want to project the graph from Neo4j using GraphDataScience.
I've been using this documentation and I indeed managed to project the nodes and vertices of the graph:

Code

from graphdatascience import GraphDataScience

AURA_CONNECTION_URI = "neo4j+s://xxxx.databases.neo4j.io"
AURA_USERNAME = "neo4j"
AURA_PASSWORD = "my_code:)"

### Client instantiation
gds = GraphDataScience(
    AURA_CONNECTION_URI,
    auth=(AURA_USERNAME, AURA_PASSWORD),
    aura_ds=True
)

### Shorthand projection --works
shorthand_graph, result = gds.graph.project(
    "short-example-graph",
    ["Paper"],
    ["Citation"]
)

When I do print(result) it shows

nodeProjection {'Paper': {'label': 'Paper', 'properties': {}}}
relationshipProjection {'Citation': {'orientation': 'NATURAL', 'aggre...
graphName short-example-graph
nodeCount 2708
relationshipCount 10556
projectMillis 34
Name: 0, dtype: object

However, no properties of the nodes are projected. I then use the extended syntax as described in the documentation:

### Project a graph using the extended syntax
extended_form_graph, result = gds.graph.project(
    "Long-form-example-graph",
    {'Paper': {"properties": "x"}},
    "Citation"
)

print(result)

#Errors
I get the error:
ClientError: {code: Neo.ClientError.Procedure.ProcedureCallFailed} {message: Failed to invoke procedure gds.graph.project: Caused by: java.lang.UnsupportedOperationException: Loading of values of type String is currently not supported}

Also, note that all my properties are integers in the Neo4j db (in AuraDS), so that the error that String properties are not supported does not make sense to me.

Some clarification on the correct way of projecting node features (aka properties) would be very useful.

thank you,
Dina

Hello @doris_voina ,
Your graph looks a lot like the Cora dataset :slight_smile:

The error message is likely correct, that at least one of your nodes has the property x of type string instead of a number.
You can check this by using

MATCH (t:Paper)
WHERE t.x = toString(t.x)
RETURN count(t);

If the count is >0, you can convert the properties using

MATCH (t:Paper)
Set t.x = toFloat(t.x)
RETURN count(t);