Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-23-2022 09:43 AM
I have the following graph:
I'm looking for a gds algorithm that can find inside the graph in a way, that given the start-point all end-points can be reached.
Like here:
So far I've tried Dijkstra Single Source & Depth First Search algorithms & Nth degree relationships with pure cypher but to no avail.
I have several similar graphs and therefore I am rather looking for an algorithmic solution but I am open to any suggestions.
cypher code:
:begin
CREATE CONSTRAINT ON (node:Node1) ASSERT (node.node1) IS UNIQUE;
CREATE CONSTRAINT ON (node:Node2) ASSERT (node.node2) IS UNIQUE;
:commit
:begin
UNWIND [{node1:"D100660078", properties:{CASE_ID:9}}, {node1:"D100660074", properties:{CASE_ID:9}}, {node1:"D100660080", properties:{CASE_ID:9}}, {node1:"200030914", properties:{CASE_ID:9}}, {node1:"D100660082", properties:{CASE_ID:9}}, {node1:"2100020143", properties:{CASE_ID:9}}, {node1:"D100660076", properties:{CASE_ID:9}}, {node1:"1600020093", properties:{CASE_ID:9, start_marker:1}}] AS row
CREATE (n:Node1{node1: row.node1}) SET n += row.properties;
UNWIND [{node2:"200030914", properties:{CASE_ID:9}}, {node2:"2100020143", properties:{CASE_ID:9}}] AS row
CREATE (n:Node2{node2: row.node2}) SET n += row.properties;
:commit
:begin
UNWIND [{start: {node2:"2100020143"}, end: {node1:"2100020143"}, properties:{}}, {start: {node2:"200030914"}, end: {node1:"200030914"}, properties:{}}, {start: {node2:"2100020143"}, end: {node1:"D100660076"}, properties:{}}, {start: {node2:"2100020143"}, end: {node1:"D100660080"}, properties:{}}, {start: {node2:"2100020143"}, end: {node1:"D100660078"}, properties:{}}, {start: {node2:"2100020143"}, end: {node1:"D100660074"}, properties:{}}, {start: {node2:"2100020143"}, end: {node1:"D100660082"}, properties:{}}, {start: {node2:"200030914"}, end: {node1:"2100020143"}, properties:{}}, {start: {node2:"200030914"}, end: {node1:"1600020093"}, properties:{}}] AS row
MATCH (start:Node2{node2: row.start.node2})
MATCH (end:Node1{node1: row.end.node1})
CREATE (start)-[r:GOES]->(end) SET r += row.properties;
:commit
All the sessions of the conference are now available online