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 !
Hi @2040688118
You can project properties using a dict - The graph object - Neo4j Graph Data Science Client
Have a look at the extended example here: https://neo4j.com/docs/graph-data-science/current/graph-project/#relationship-projection-syntax
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!