I have Nodes Customer and Product - with a directed relationship TRANSACTION from Customer to Product.
Product has the property category
.
Is it possible to display all the Customers connected to all the categories which they have bought? As though the categories were a node rather than a property.
You can use APOC Virtual Nodes and Relationships to display such graph :
MATCH (n:Product)<-[:TRANSACTION]-(c:Customer)
WITH n.category AS category, c, count(*) AS numberOfPurchases
WITH
apoc.create.vNode(['Category'], {name: category}) AS catNode,
c,
numberOfPurchases
RETURN catNode, c,
apoc.create.vRelationship(c, 'PURCHASED_IN_CATEGORY', {amount: numberOfPurchases}, catNode) AS rel