Neo4j is a Graph Database

Neo4j is a NOSQL hipster with serious business credentials.

A Graph Database

Neo4j stores data in a Graph, with records called Nodes. The simplest graph has just a single node with some named values called Properties.

Let's draw a social graph of our friends on the Neo4j team:

  1. Draw a circle for the node
  2. Add the name Emil
  3. Note that he is from Sweden

Not yet friends with the team? Then we're future friends.

More Nodes

Like any database, storing data in Neo4j can be as simple as adding more records. Here, we'll add a few more nodes for Neo4j people:

  1. Emil has a klout score of 99
  2. Johan, from Sweden, who is learning to surf
  3. Ian, from England, who is an author
  4. Rik, from Belgium, has a cat named Orval
  5. Allison, from California, who surfs

Seriously, a Neo4j graph can hold multiples of the human population.

Now consider Relationships

The real power of Neo4j is in connected data. To connect any two nodes, add a Relationship which describes how the data is related.

In our social graph, we simply say who KNOWS whom:

  1. Emil KNOWS Johan and Ian
  2. Johan KNOWS Ian and Rik
  3. Rik and Ian KNOWS Allison

Having real relationships just feels better, doesn't it?

Relationships are data

In a property graph, relationships are data structures that can also store data.

Looking more closely at Emil's relationships, note that:

Relationships are First Class Citizens in Neo4j.

Summary

Neo4j stores data in a property graph made up of nodes and relationships, with properties on both. Absolutely any domain can be stored in a graph.

Having "whiteboarded" a graph, you are ready to create a graph in Neo4j.

Next steps:

Or, see other guides.