intro to neo4j with ruby

28
Introducing Neo4j Your Next Database Max De Marzi

Upload: max-de-marzi

Post on 27-Jan-2015

112 views

Category:

Technology


0 download

DESCRIPTION

A quick introduction to Graphs, Neo4j and neography.

TRANSCRIPT

Page 1: Intro to Neo4j with Ruby

Introducing Neo4jYour Next Database

Max De Marzi

Page 2: Intro to Neo4j with Ruby

About Me

• My Blog: http://maxdemarzi.com• Find me on Twitter: @maxdemarzi• Email me: [email protected]• GitHub: http://github.com/maxdemarzi

Built the Neography Gem (Ruby Wrapper to the Neo4j REST API)Playing with Neo4j since 10/2009

Page 3: Intro to Neo4j with Ruby

Agenda

• What is a Graph?• What is a Graph Database?• What can you do with a Graph Database?

Page 4: Intro to Neo4j with Ruby

What is a Graph?

• An abstract representation of a set of objects where some pairs are connected by links.

Object (Vertex, Node)

Link (Edge, Arc, Relationship)

Page 5: Intro to Neo4j with Ruby

Different Kinds of Graphs

• Undirected Graph• Directed Graph

• Pseudo Graph• Multi Graph

• Hyper Graph

Page 6: Intro to Neo4j with Ruby

More Kinds of Graphs

• Weighted Graph

• Labeled Graph

• Property Graph

Page 7: Intro to Neo4j with Ruby

What is a Graph Database?

• A database with an explicit graph structure• Each node knows its adjacent nodes• As the number of nodes increases, the cost of

a local step (or hop) remains the same

Page 8: Intro to Neo4j with Ruby

Good For

• Highly connected data (social networks)• Recommendations (e-commerce)• Path Finding (how do I know you?)• A* (Least Cost path)• Data First Schema (bottom-up, but you still

need to design)

Page 9: Intro to Neo4j with Ruby

Not so good for

• Set Operations:– Union– Intersection– Cross Joins

• Ginormous Amounts of Data– Billions ok, Trillions not so much.

Page 10: Intro to Neo4j with Ruby

What is Neo4j?

• A Graph Database + Lucene Index• Property Graph• Full ACID (atomicity, consistency, isolation,

durability)• High Availability (with Enterprise Edition)• 32 Billion Nodes, 32 Billion Relationships,

64 Billion Properties• Embedded Server• REST API

Page 11: Intro to Neo4j with Ruby

Neo4j + Ruby

Page 12: Intro to Neo4j with Ruby

Neo4j Data Browser

Page 13: Intro to Neo4j with Ruby

Neo4j Console

Page 14: Intro to Neo4j with Ruby

Friends Graph Illustrated

Page 15: Intro to Neo4j with Ruby

Friends Graph

Page 16: Intro to Neo4j with Ruby

Relationships

.both is actually creating two relationships. One incoming and one outgoing friends relationship.

Each Relationship in Neo4j only goes in one direction.

Page 17: Intro to Neo4j with Ruby

Friends of Friends

Page 18: Intro to Neo4j with Ruby

All Simple Paths

Simple paths means no loops allowed

Page 19: Intro to Neo4j with Ruby

Shortest Path

Page 20: Intro to Neo4j with Ruby
Page 21: Intro to Neo4j with Ruby
Page 22: Intro to Neo4j with Ruby

Cypher : Neo4j Query Language

ASCII ART FTW: a--b, a-->b, a<--c

Page 23: Intro to Neo4j with Ruby
Page 24: Intro to Neo4j with Ruby

Neoflix: Movie Recommender

http://neoflix.herokuapp.com/

Page 25: Intro to Neo4j with Ruby

http://getvouched.com

Page 26: Intro to Neo4j with Ruby

Neo4j and Heroku Challenge

http://neo4j-challenge.herokuapp.com/

Page 27: Intro to Neo4j with Ruby

Questions?

?

Page 28: Intro to Neo4j with Ruby

Thank you!http://maxdemarzi.com