Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-25-2021 04:59 PM
I am trying to write a configuration map for gds.wcc.write
that goes through a bridge node, with specified relationships.
I think that I need cypher projection, because native projection didnt seem to be able to handle the jump, but potentially I am missing something.
Here is the schema, I need to identify all Equipment connected by a leg
Here is what I have
CALL gds.wcc.stream({
nodeQuery: "MATCH (n) WHERE n:Equipment OR n:Leg OR n:OPCODE RETURN id(n) as id",
relationshipQuery: "MATCH (s:Equipment)-[r1:DRAINS]->(l:Leg)-[r2:FEEDS]->(t:Equipment) RETURN id(s) AS source, id(t) AS target, id(l) as leg, id(r1) as feed, id(r2) as prod"}
)
Originally I was connecting Equipment directly next to Equipment with a different relationship, but now I need to add this Leg in the middle of things. Originally I could just execute this:
CALL gds.wcc.write({nodeProjection: "Equipment", relationshipProjection: "CONNECTS_TO",writeProperty: "community_id"}
Thanks for any help!
Solved! Go to Solution.
03-26-2021 07:40 AM
Hello Keith,
This will indeed create a projection with all your :Equipment and :Leg nodes, with the FEEDS and DRAINS relationships between them.
As for the orientation, this is configurable, and it maintains the original orientation by default. See the docs here.
This parameter only allows you to define the relationship orientation to its original orientation, or reverse it, or add both directions ; if you need a filter like "I only want the FEEDS rels that go from a Leg to an Equipment", then Cypher projection is the way to go. If you relationship is uni-directional anyway, then your solution is the right one.
Cheers !
03-25-2021 05:39 PM
Actually I think that this did what I was looking for!
CALL gds.wcc.write({nodeProjection: ["Equipment", "Leg"], relationshipProjection: ["FEEDS", "DRAINS"],writeProperty: "community_id"})
It doesn't really specify the order of the connection though, so I am not sure if its 100% correct.
03-26-2021 07:40 AM
Hello Keith,
This will indeed create a projection with all your :Equipment and :Leg nodes, with the FEEDS and DRAINS relationships between them.
As for the orientation, this is configurable, and it maintains the original orientation by default. See the docs here.
This parameter only allows you to define the relationship orientation to its original orientation, or reverse it, or add both directions ; if you need a filter like "I only want the FEEDS rels that go from a Leg to an Equipment", then Cypher projection is the way to go. If you relationship is uni-directional anyway, then your solution is the right one.
Cheers !
All the sessions of the conference are now available online