Neo4j Live

Neo4j:the Graph Database

You know relational, now consider relationships

Start to notice that graphs are everywhere

Then use Neo4j to make sense of your data

Your path towards Graph Enlightenment starts here:


Getting Started

Learn about Neo4j

Neo4j is a graph database. Records are called nodes and the connections between records are first-class citizens called relationships.

Neo4j refers to all of this as a Property Graph — nodes and relationships with key-value properties on both.

Querying is performed through a traversal, using the delightful Cypher query language. It's like a friendly, pattern-matching version of SQL.

You Know Relational »

Ye Olde Join Table

This you already know

That the "relational" in RDBMS is simply a foreign key, a fairly humble reference to another record. Typically the column will be the same as the primary key in the other table, and the constraint will say something about the connection. To provide more information, use a...

Join table

Buried in the schema of every relational database on the planet, one or more join tables lurk. While the convention adds valuable information about how records relate, queries across multiple joins on large data sets can cause join pain.

Now, consider graph relationships »

Join Table

Graph Relationships

Relationships as first-class citizens

In a graph database like Neo4j, relationships are essential data elements. Down to the bare metal, Neo4j is optimized for managing the relationships between records, resulting in queries that are 1000x faster.

How can it be that much faster?

In a graph traversal, only the local data affects the query speed, and because relationships are materialized as actual structures, finding local data is extremely fast. And, it isn't affected by the growth of the entire data set. What happens to your RDBMS join queries when the data set grows?

Graph Relationships

Bootstrap Your App

Thanks to outstanding Neo4j community member Aseem Kishore there is a nice Node.js driver for Neo4j. As a bonus, Aseem also created a template project which we've used as the basis for this project.

You'll need a few things to get started:

  • Download the latest Neo4j
  • Install the current version of Node.js
  • Optionally, create an account on Heroku

Note: Early release API docs now available for Neo4j-Node!


Clone this Project

# Start Neo4j
./bin/neo4j start

# clone this project
git clone

# Make it go...
cd node-neo4j-demo
npm install
npm start

Congratulations! A fresh clone of the template project will be created for you, ready to use and easily customized for your own clever purposes.

Deploy on Heroku

# create an application (remember the assigned name)
heroku apps:create

# add neo4j add-on
heroku addons:add neo4j

git push heroku master
heroku open

Simple, right? Now you've got a Neo4j+Node.js application deployed in the cloud.

Now you're ready to try out the running application

Querying Live Data

Get Social

The example application is a simple social network manager. You can add and remove users, then indicate who "follows" who to create a Twitter-like graph.

Try the app: View all users

Direct access

Once you've tried out using the mini-application directly, you can open Neo4j's web interface to check out the raw data and run some queries.

Check it out live right now:*

  • Dashboard: an overview of the database, with vital stats and a chart showing change over time
  • Data browser: data inspector and visualizer (use the righmost button in the toolbar to toggle)
  • Console: a REPL for running Cypher queries, or testing out REST API calls

*Note that you may get a phishing warning because we've encoded the password in these URLs.

Try these Cypher queries on the live data

  1. Count all people in the social network:
    start n=node(*) return count(n);
  2. Find the friends of node 1:
    start n=node(1) match (n)-[:follows]-(m) return m;                        
  3. The classic friends-of-a-friend (FoaF) query:
    start me=node(1) match (me)-[:follows]-(friends)-[:follows]-(foaf) return foaf;



blog comments powered byDisqus

Learn more about Neo4j out on the intertubes:

  • Twitter
  • Twitter
  • You Tube
  • Linked In

Contact us directly:

Fork me on GitHub