GraphSAGE for heterogenous graph

Hi everyone.

I have tried to use node embeddings as suggested but i wonder is it possible to do node embeddings with this much of different node labels and relationships?

I tried to use GraphSAGE but I kept getting error, which is

Is this because I did not specify defaultValue: 0 when I created my graph? This is how I created my graph.

Hope I can get answer to is it plausible to use GraphSAGE for this.

It looks like you aren't including any node properties when creating your graph. I would reference this code sample from this example from the docs.

CALL gds.graph.create(
    Person: {
      label: 'Person',
      properties: ['age', 'heightAndWeight']
    Instrument: {
      label: 'Instrument',
      properties: ['cost']
  }, {
    KNOWS: {
      type: 'KNOWS',
      orientation: 'UNDIRECTED'
    LIKES: {
      type: 'LIKES',
      orientation: 'UNDIRECTED'
CALL gds.beta.graphSage.train(
    modelName: 'multiLabelModel',
    featureProperties: ['age', 'heightAndWeight', 'cost'],
    projectedFeatureDimension: 4

Hi Sean,

Thanks for replying.

I have tried created a different graph based on the reference you shared:

But it still gives the same error.
Failed to invoke procedure gds.beta.graphSage.train: Caused by: java.lang.IllegalArgumentException: The feature properties ['JobVector'] are not present for all requested labels. Requested labels: ['Course', 'Field', 'Jobads', 'Jobbg', 'Joblevel', 'Qual', 'Skill', 'University', 'User']. Properties available on all requested labels:

Thank you for your help!

Well here it looks like your JobVector property is a property of the WORK_AS relationship, not a node. In which case, the featureProperties parameter won't see it as it refers to node properties. I think you want the relationshipWeightProperty parameter in this case. Although I'm not sure if it is required to exist on all relationships.

Hi Sean,

I changed it to relationshipWeightProperty parameter and i think that's correct too. But still, it is showing the same error. I guess it is required to exist on all relationships.

Thank you though for your help!

Hey @nuraishahzaidi01,
as Sean already mentioned, the featureProperties only look for node properties in the projected graph.

Is your JobVector a node or a relationship property?
Important to note is, that currently GDS does not support array properties on relationships.
Supported relationship properties are doubles and integers (see Creating graphs - Neo4j Graph Data Science).

Hi @florentin.dorre,

My JobVector is a relationship property.
Ahh I see, I'm sorry I think I missed out on that one. Thank you for your clarification, I will have to try to find some other ways to include the array in the graph then.

Thanks again!

Glad I could help.
We can also try to make the documentation clearer. Do you have a suggestion at which place you would have expected to read the limitation?

Hi @florentin.dorre,

Very sorry for the late reply, I have been moved to another project and had to stop doing this one. But on your question, I think in the documentation if it's possible to have " GDS does not support array properties on relationships" as a ! caution or something along the lines would be great. If this can be included in the 2.5. Relationship properties.

Because I got confused with the properties type (in 1.2 Relationship Projection as shown in the photo). I thought the type for properties meant for properties on the relationships.

That was my mistake.

Thank you again. Looking forward to use Neo4j in the future :)

1 Like