SlideShare a Scribd company logo
Introduction to
Graph DatabasesChicago Graph Database Meet-Up
Max De Marzi
About Me
• My Blog: http://maxdemarzi.com
• Find me on Twitter: @maxdemarzi
• Email me: maxdemarzi@gmail.com
• GitHub: http://github.com/maxdemarzi
Built the Neography Gem (Ruby
Wrapper to the Neo4j REST API)
Playing with Neo4j since 10/2009
Agenda
• Trends in Data
• NOSQL
• What is a Graph?
• What is a Graph Database?
• What is Neo4j?
Trends in Data
Data is getting bigger:
“Every 2 days we
create as much
information as we did
up to 2003”
– Eric Schmidt, Google
Data is more connected:
• Text (content)
• HyperText (added pointers)
• RSS (joined those pointers)
• Blogs (added pingbacks)
• Tagging (grouped related data)
• RDF (described connected data)
• GGG (content + pointers + relationships +
descriptions)
Data is more Semi-Structured:
• If you tried to collect all the data of every
movie ever made, how would you model it?
• Actors, Characters, Locations, Dates, Costs,
Ratings, Showings, Ticket Sales, etc.
NOSQL
Not Only SQL
Less than 10% of the NOSQL Vendors
Key Value Stores
• Most Based on Dynamo: Amazon Highly
Available Key-Value Store
• Data Model:
– Global key-value mapping
– Big scalable HashMap
– Highly fault tolerant (typically)
• Examples:
– Redis, Riak, Voldemort
Key Value Stores: Pros and Cons
• Pros:
– Simple data model
– Scalable
• Cons
– Create your own “foreign keys”
– Poor for complex data
Column Family
• Most Based on BigTable: Google’s Distributed
Storage System for Structured Data
• Data Model:
– A big table, with column families
– Map Reduce for querying/processing
• Examples:
– HBase, HyperTable, Cassandra
Column Family: Pros and Cons
• Pros:
– Supports Simi-Structured Data
– Naturally Indexed (columns)
– Scalable
• Cons
– Poor for interconnected data
Document Databases
• Data Model:
– A collection of documents
– A document is a key value collection
– Index-centric, lots of map-reduce
• Examples:
– CouchDB, MongoDB
Document Databases: Pros and Cons
• Pros:
– Simple, powerful data model
– Scalable
• Cons
– Poor for interconnected data
– Query model limited to keys and indexes
– Map reduce for larger queries
Graph Databases
• Data Model:
– Nodes and Relationships
• Examples:
– Neo4j, OrientDB, InfiniteGraph, AllegroGraph
Graph Databases: Pros and Cons
• Pros:
– Powerful data model, as general as RDBMS
– Connected data locally indexed
– Easy to query
• Cons
– Sharding ( lots of people working on this)
• Scales UP reasonably well
– Requires rewiring your brain
RDBMS
Living in a NOSQL World
Complexity
BigTable
Clones
Size
Key-Value
Store
Document
Databases
Graph
Databases
90% of
Use Cases
Relational
Databases
What is a Graph?
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)
Different Kinds of Graphs
• Undirected Graph
• Directed Graph
• Pseudo Graph
• Multi Graph
• Hyper Graph
More Kinds of Graphs
• Weighted Graph
• Labeled Graph
• Property Graph
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
• Plus an Index for lookups
Compared to Relational Databases
Optimized for aggregation Optimized for connections
Compared to Key Value Stores
Optimized for simple look-ups Optimized for traversing connected data
Compared to Key Value Stores
Optimized for “trees” of data Optimized for seeing the forest and the
trees, and the branches, and the trunks
What is Neo4j?
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
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)
Property Graph
// then traverse to find results
start n=(people-index, name, “Andreas”)
match (n)--()--(foaf) return foaf
n
Cypher
// get node 0
start a=(0) return a
// traverse from node 1
start a=(1) match (a)-->(b) return b
// return friends of friends
start a=(1) match (a)--()--(c) return c
Pattern Matching Query Language (like SQL for graphs)
// get node 0
g.v(0)
// nodes with incoming relationship
g.v(0).in
// outgoing “KNOWS” relationship
g.v(0).out(“KNOWS”)
Gremlin
A Graph Scripting DSL (groovy-based)
If you’ve ever
• Joined more than 7 tables together
• Modeled a graph in a table
• Written a recursive CTE
• Tried to write some crazy stored procedure
with multiple recursive self and inner joins
You should use Neo4j
name
code
word_count
Language
name
code
flag_uri
Country
IS_SPOKEN_IN
as_primary
language_code
language_name
word_count
Language
country_code
country_name
flag_uri
Country
language_code
country_code
primary
LanguageCountry
name: “Canada”
languages_spoken: “[ ‘English’, ‘French’ ]”
name: “Canada”
language:“English”
language:“French”
name: “USA”
name: “France”
spoken_in
spoken_in
name
flag_uri
language_name
number_of_words
yes_in_langauge
no_in_language
currency_code
currency_name
Country
name
flag_uri
Country
name
number_of_words
yes
no
Language
SPEAKS
code
name
Currency
Neo4j Data Browser
Neo4j Console
console.neo4j.org
Try it right now:
start n=node(*) match n-[r:LOVES]->m return n, type(r), m
Notice the two nodes in red, they are your result set.
What does a Graph look like?
Questions?
?
Thank you!
http://maxdemarzi.com

More Related Content

PPT
Graph database
PDF
Graph Database
PPTX
Introduction to Graph Databases
PPTX
Intro to Neo4j with Ruby
PDF
Getting started with Graph Databases & Neo4j
PPTX
NoSQL Graph Databases - Why, When and Where
PPTX
Graph databases
PPTX
Graph database & neo4j
Graph database
Graph Database
Introduction to Graph Databases
Intro to Neo4j with Ruby
Getting started with Graph Databases & Neo4j
NoSQL Graph Databases - Why, When and Where
Graph databases
Graph database & neo4j

What's hot (20)

PDF
Neo4j in Depth
PDF
RDBMS to Graph
PPTX
Using Neo4j from Java
ODP
Graph databases
PPTX
London HUG
PPTX
MongoDB & Hadoop - Understanding Your Big Data
PPTX
Graph Databases & OrientDB
PDF
Gerry McNicol Graph Databases
PPTX
Neo4j - graph database for recommendations
PDF
Drupal and the Semantic Web - ESIP Webinar
PPT
NoSQL Databases
PPTX
Performance of graph query languages
PDF
Using MongoDB + Hadoop Together
PDF
Introduction to Graph Database
PPTX
The openCypher Project - An Open Graph Query Language
PDF
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
PPSX
The Web of data and web data commons
PDF
Performance comparison: Multi-Model vs. MongoDB and Neo4j
PDF
Analyzing Web Archives
PPT
An Introduction to Graph Databases
Neo4j in Depth
RDBMS to Graph
Using Neo4j from Java
Graph databases
London HUG
MongoDB & Hadoop - Understanding Your Big Data
Graph Databases & OrientDB
Gerry McNicol Graph Databases
Neo4j - graph database for recommendations
Drupal and the Semantic Web - ESIP Webinar
NoSQL Databases
Performance of graph query languages
Using MongoDB + Hadoop Together
Introduction to Graph Database
The openCypher Project - An Open Graph Query Language
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
The Web of data and web data commons
Performance comparison: Multi-Model vs. MongoDB and Neo4j
Analyzing Web Archives
An Introduction to Graph Databases
Ad

Viewers also liked (7)

PPT
NoSQL databases pros and cons
PDF
GraphTalks Rome - Introducing Neo4j
PPTX
HBase Vs Cassandra Vs MongoDB - Choosing the right NoSQL database
PDF
Neo4j PartnerDay Amsterdam 2017
PDF
NOSQLEU - Graph Databases and Neo4j
PDF
Graph database Use Cases
PDF
Data Modeling with Neo4j
NoSQL databases pros and cons
GraphTalks Rome - Introducing Neo4j
HBase Vs Cassandra Vs MongoDB - Choosing the right NoSQL database
Neo4j PartnerDay Amsterdam 2017
NOSQLEU - Graph Databases and Neo4j
Graph database Use Cases
Data Modeling with Neo4j
Ad

Similar to Graph Databases (20)

PDF
managing big data
PPTX
Neo4j Training Introduction
PPTX
Graph Databases
PPT
Graph Database and Neo4j
PPTX
Graphs fun vjug2
PDF
Graph databases and the #panamapapers
PPTX
PPTX
PPTX
No SQL : Which way to go? Presented at DDDMelbourne 2015
PPTX
NoSQL, which way to go?
PDF
Combine Spring Data Neo4j and Spring Boot to quickl
PPTX
Sharing a Startup’s Big Data Lessons
PPTX
Large Scale Graph Analytics with JanusGraph
PPTX
Large Scale Graph Analytics with JanusGraph
PDF
MongoDB Basics
KEY
NoSQL in the context of Social Web
PPTX
Neo4j GraphTalk Oslo - Introduction to Graphs
PDF
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
PPTX
CSC 8101 Non Relational Databases
KEY
Modeling Data in MongoDB
managing big data
Neo4j Training Introduction
Graph Databases
Graph Database and Neo4j
Graphs fun vjug2
Graph databases and the #panamapapers
No SQL : Which way to go? Presented at DDDMelbourne 2015
NoSQL, which way to go?
Combine Spring Data Neo4j and Spring Boot to quickl
Sharing a Startup’s Big Data Lessons
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
MongoDB Basics
NoSQL in the context of Social Web
Neo4j GraphTalk Oslo - Introduction to Graphs
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
CSC 8101 Non Relational Databases
Modeling Data in MongoDB

More from thai (11)

PDF
Bài giảng sql server 2008
PDF
Bài 1. phân tích đặc tả dự án quản lý sinh viên howkteam.com
PDF
04 ham-ket-hop-gom-nhom
PDF
3 mucluc thuchanh-cosodulieu
PDF
02 sql dml_commands
PDF
01 sql ddl_commands
PDF
00 overview of_sql_server
PDF
Oer basics h2-2021
PDF
Oer basics h2-2021
PPT
Chuong 4 lien_he_giua_uml_va_orm
PPTX
Cryptography and applications
Bài giảng sql server 2008
Bài 1. phân tích đặc tả dự án quản lý sinh viên howkteam.com
04 ham-ket-hop-gom-nhom
3 mucluc thuchanh-cosodulieu
02 sql dml_commands
01 sql ddl_commands
00 overview of_sql_server
Oer basics h2-2021
Oer basics h2-2021
Chuong 4 lien_he_giua_uml_va_orm
Cryptography and applications

Recently uploaded (20)

PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Structure & Organelles in detailed.
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Basic Mud Logging Guide for educational purpose
PDF
RMMM.pdf make it easy to upload and study
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
master seminar digital applications in india
Abdominal Access Techniques with Prof. Dr. R K Mishra
O7-L3 Supply Chain Operations - ICLT Program
Supply Chain Operations Speaking Notes -ICLT Program
Classroom Observation Tools for Teachers
Cell Structure & Organelles in detailed.
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Anesthesia in Laparoscopic Surgery in India
PPH.pptx obstetrics and gynecology in nursing
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Microbial disease of the cardiovascular and lymphatic systems
Basic Mud Logging Guide for educational purpose
RMMM.pdf make it easy to upload and study
GDM (1) (1).pptx small presentation for students
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
2.FourierTransform-ShortQuestionswithAnswers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Final Presentation General Medicine 03-08-2024.pptx
Insiders guide to clinical Medicine.pdf
master seminar digital applications in india

Graph Databases

Editor's Notes

  • #22: An undirected graph is one in which edges have no orientation. The edge (a, b) is identical to the edge (b, a). A directed graph or digraph is an ordered pair D = (V, A) A pseudo graph is a graph with loops A multi graph allows for multiple edges between nodes A hyper graph allows an edge to join more than two nodes
  • #23: A weighted graph has a number assigned to each edge A labeled graph has a label assigned to each node or edge A property graph has keys and values for each node or edge
  • #29: Atomic = all or nothing, consistent = stay consistent from one tx to another, isolation = no tx will mess with another tx, durability = once tx committed, it stays