Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-29-2021 12:47 PM
Hello!
I have a set of nodes that I get with:
Match (p:Person) WHERE p.Netzwerke = 7 CALL apoc.neighbors.tohop(p,"connect",2) yield node return node
In the Neo4J Browser it also shows me all the existing relationships between that nodes but I can only yield the nodes without this relationships. Is there a way to get the list of nodes with all the existing relationships between them? I would like to export that list of nodes with their relationships to Gephi. I am thankful for every idea!
Best regards,
Lars
03-29-2021 06:34 PM
apoc.algo.cover()
is a procedure you can use to get all the relationships that exist between a collection of nodes. This is similar to what the browser does...after it gets back nodes from the original query it sends out a second query to get all the relationships between those nodes. There's a checkbox you can use to toggle that on or off in the browser preferences.
Here's how you would do this in the query:
Match (p:Person)
WHERE p.Netzwerke = 7
CALL apoc.neighbors.tohop(p,"connect",2) yield node
WITH collect(node) as nodes
CALL apoc.algo.cover(nodes) YIELD rel
WITH nodes, collect(rel) as rels
RETURN nodes, rels
03-30-2021 02:33 PM
I most certainly did not know about this.
Thank for i have learned something new.
03-30-2021 02:11 AM
Worked perfectly! Thank you very much!
All the sessions of the conference are now available online