Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Forked from suellenstringer-hye/roosevelt
Last active August 29, 2015 14:08
Show Gist options
  • Save CliffordAnderson/a266e8eff425ff16ffcb to your computer and use it in GitHub Desktop.
Save CliffordAnderson/a266e8eff425ff16ffcb to your computer and use it in GitHub Desktop.
A learning exercise for Neo4j

Roosevelt Family Geneaology

Purpose of Graph

This very simple graph was used to help introduce students to graphing concepts. We started the class with a powerpoint presentation covering the nature of networks and graphs and basic coding for Cypher so that they would be prepared to work on a [Neo4j GraphGist](http://gist.neo4j.org/) on their own by the end of the hour class. Since everyone intuitively understands that family trees are derived from a set of relationships, the class was assigned to fork the graph below.

OUR DATASET

CREATE
//People
(nicholas:Person {name:'Nicholas Roosevelt', birth: 1658}),
(eleanor:Person {name:'Anna Eleanor Roosevelt', birth: 1884}),
(franklin:Person {name:'Franklin D. Roosevelt', birth: 1882}),
(theodore:Person {name:'Theodore Roosevelt', birth: 1858}),
(elliott:Person {name:'Elliott Roosevent', birth: 1860}),
(james:Person {name:'James Roosevelt', birth: 1828}),
(johannes:Person {name:'Johannes Roosevelt', birth: 1689}),


//Relationships
//Marriages
(eleanor)-[:MARRIED]->(franklin),
(franklin)-[:MARRIED]->(eleanor),

//Children
(elliott)-[:BEGAT]->(eleanor)

Encoding Exercise

Please consult the [Roosevelt family tree](https://en.wikipedia.org/wiki/Roosevelt_family) on Wikipedia and add additional elements to the family tree.

Querying with Cypher

Now let’s write some queries!

Name the People in the Graph

MATCH (person)-[:WAS_FROM]->(location)
RETURN person.name AS Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment