Created
December 23, 2015 18:22
-
-
Save akollegger/0656f7358c3e4cf5cf25 to your computer and use it in GitHub Desktop.
Reindeer Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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