Skip to content

Instantly share code, notes, and snippets.

@pducrot
Last active March 18, 2019 06:33
Show Gist options
  • Save pducrot/d8cc544438631c3a8d3bb74106f9038a to your computer and use it in GitHub Desktop.
Save pducrot/d8cc544438631c3a8d3bb74106f9038a to your computer and use it in GitHub Desktop.
People network
src,tgt
A,B
A,C
B,C
C,D
== Domain
== Setup
//hide
//setup
[source,cypher]
----
CREATE CONSTRAINT ON (n:Person) ASSERT n.Name IS UNIQUE;
LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/pducrot/d8cc544438631c3a8d3bb74106f9038a/raw/b681ffd513d13f1bebd6122a23ffca691b984fc9/knows.edges' as line FIELDTERMINATOR ',' MERGE (s:Person {Name: line.src}) MERGE (t:Person {Name: line.tgt}) CREATE (s)-[:KNOWS]-> (t) RETURN count(*);
----
//setup
[source,cypher]
----
MATCH path = (:Person {Name: "A"}) -[:KNOWS*]-> (:Person)
RETURN path
----
//graph_result
Name
A
B
C
D
E
F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment