I have created a graph database using py2neo in python3. I create relationships using the following code:
from py2neo import Graph,Node,Relationship
G=Graph()
node0=Node('Female',memberid=1234)
node1=Node('Male',memberid=3456)
node0_node1=Relationship(node0,'matched',node1)
node1_node0=Relationship(node1,'matched',node0)
G.merge(node0_node1)
G.merge(node1_node0)
node2=Node('Female',memberid=1357)
node3=Node('Male',memberid=3456)
node2_node3=Relationship(node2,'swiped_on',node3)
G.merge(node2_node3)
Problem 1: I want to return only the paths where male points to female, I tried:
match (m:Male)-->(f:Female) return m,f
I only want (1234)<--(3456)-->(1357), but instead get:
I then want to only return paths where a female swiped on a male, I tried:
match (f:Female)-[:swiped_on]->(m:Male) return m,f
I only wanted (1357)-[swiped_on]->(3456), instead I got:
I'm guessing you're running this in the browser. When viewing the graph results, there's a control that says Auto-Complete, and it's currently set to ON. When it's on, the graph result will query and show all other relationships between returned nodes, even if they weren't part of the original query. To see only what was matched by your query, turn auto complete off.