Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reindeer Graph
// Pair Bolt with Rudolf
MATCH (blitzen:Reindeer {name:"Blitzen"})-[blitzenToRudolf]->(rudolf:Reindeer {name:"Rudolf"})
WITH rudolf,blitzen,blitzenToRudolf
DELETE blitzenToRudolf
CREATE (bolt {name:"Bolt", strength:11})-[:PAIR]->(rudolf), (blitzen)-[:FOLLOWS]->(bolt)
RETURN bolt,rudolf,blitzen
// Find strongest pair of Reindeer in the team
MATCH (:Vehicle {type:"Sleigh"})<-[:PULLS]-(deer:Reindeer)
WITH deer LIMIT 1
MATCH (deer)-[:FOLLOWS*]->(other1)-[:PAIR]-(other2)
RETURN other1, other2, other1.strength + other2.strength as pairStrength
ORDER BY pairStrength DESC LIMIT 1
// CREATE Reindeer Team
CREATE (dasher:Reindeer {name:"Dasher", strength: 8})
CREATE (dasher)-[:PAIR]->(dancer:Reindeer {name:"Dancer", strength: 6})
CREATE (prancer:Reindeer {name:"Prancer", strength: 5})
CREATE (prancer)-[:PAIR]->(vixen:Reindeer {name:"Vixen", strength: 6})
CREATE (comet:Reindeer {name:"Comet", strength: 7})
CREATE (comet)-[:PAIR]->(cupid:Reindeer {name:"Cupid", strength: 5})
CREATE (donner:Reindeer {name:"Donner", strength: 8})
CREATE (donner)-[:PAIR]->(blitzen:Reindeer {name:"Blitzen", strength: 7})
CREATE (rudolf:Reindeer {name:"Rudolf", strength: 9})
CREATE (sleigh:Vehicle {type:"Sleigh"})
CREATE (donner)-[:FOLLOWS]->(rudolf)
CREATE (blitzen)-[:FOLLOWS]->(rudolf)
CREATE (comet)-[:FOLLOWS]->(donner)
CREATE (cupid)-[:FOLLOWS]->(blitzen)
CREATE (prancer)-[:FOLLOWS]->(comet)
CREATE (vixen)-[:FOLLOWS]->(cupid)
CREATE (dasher)-[:FOLLOWS]->(prancer)
CREATE (dancer)-[:FOLLOWS]->(vixen)
CREATE (dasher)-[:PULLS]->(sleigh)
CREATE (dancer)-[:PULLS]->(sleigh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.