cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to project relationship-properties?

I project a graph in python like this:

G, res = gds.graph.project(
"graph", # Graph name
"movie", # Node projection
"times" # Relationship projection
)

but G.relationship_properties('times') = .Actually it has a propertity "weight" like 1.5,2.5......
why and how to fix it?
Thank you very much !

1 REPLY 1

Hi @2040688118

You can project properties using a dict - The graph object - Neo4j Graph Data Science

Have a look at the extended example here: Creating graphs - Neo4j Graph Data Science

You can pass in either a String: "", List: [] or Dict/Map: {} for Node & Relationship Projection.

So you could do:

G, res = gds.graph.project(
  "graph", # Graph name
  "movie", # Node projection
  { 
       times: {
          type: times,
          orientation: <orientation>, # NATURAL, UNDIRECTED, REVERSE
          aggregation: <aggregation-type>, # NONE, MIN, MAX, SUM, SINGLE, COUNT.
          properties: {
              weight: {
                  property: weight,
                  defaultValue: <fallback-value>, # Float or Integer
                  aggregation: <aggregation-type> # NONE, MIN, MAX, SUM, SINGLE, COUNT.
              }
          }
      }
  } # Relationship projection
)

It's worth noting that to help differentiate, :Labels should follow CamelCase & :RELATIONSHIP_TYPES should be in UPPERCASE_WITH_UNDERSCORES. It'll help in the long run with differentiating 🙂

Hope this helps!

Cheers!