Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-23-2021 07:33 PM
I'm new to Neo4j, and this is my first time posting. I'm trying to create a monopartite projection from a bipartite graph. I've only got two types of nodes:
My challenge is that I have a handful of different relationships. Some examples:
What I'm trying to do is
In other words, using the examples above:
Example 1:
Example 2
Example 3
I can find examples online that convert only one type of relationship to a monopartite but can't seem to get anything to work for multiple relationship or relationships that have an intervening node of a different type (i.e. two post nodes between an entity node). I've done the graph data science training and couldn't find exactly what I was looking for there either.
Any advice?
11-30-2021 01:38 PM
If you're using GDS for monopartite projections, you can write any arbitrary Cypher query for a node projection and a rel projection. This can navigate as many steps in whatever order you like.
You've already got the right patterns, abstracting a bit you might use this as a node projection:
MATCH (e:Entity) return id(e) as id
And this as a rel projection
MATCH (a:Entity)-[]-(p:Post)-[]-(b:Entity)
RETURN id(a) as from, id(b) as to
Notice we're using blank, anonymous, un-ordered relationships -[]-
meaning we don't care the rel type, we don't care which direction. We just know these things are connected with something else (a post) in the middle
07-27-2022 03:36 PM
David: I have a slightly different situation where i want to project from a bipartite subgraph to a monopartite projection, where i want to avoid creating that monopartite on disk prior to projecting. Say on disk we have:
(v:Visitor)-[:LISTENS_TO]->(s:Song)
So a possible MATCH to set up the monopartite projection could be:
MATCH (s1.Song)-[:LISTENS_TO]-(:Visitor)-[:LISTENS_TO]->(s2.Song)
where s1.uuid <> s2.uuid
I'd like to project a monopartite graph for example:
(:Song)-[:RELATED_TO]-(:Song)
Is this possible in GDS 2.1?
All the sessions of the conference are now available online