Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Graph databases for fun and profit (Geekcamp.sg)
Search
vivekprahlad
August 18, 2012
Technology
490
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Graph databases for fun and profit (Geekcamp.sg)
vivekprahlad
August 18, 2012
More Decks by vivekprahlad
See All by vivekprahlad
Continuous Delivery in Practice
vivekprahlad
0
57
Other Decks in Technology
See All in Technology
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
160
アンオフィシャルな、オフィシャルからのお願い
wyamazak_devrel
0
140
Bucharest Tech Week 2026 - Guardians of the Cloud-Native Galaxy
edeandrea
PRO
0
130
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
180
インシデントレスポンス演習 I / Incident Response Exercise I
ks91
PRO
0
100
就職⽀援サービスにおけるキャリアアドバイザーのシフトスケジューリング
recruitengineers
PRO
1
150
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
160
FPC(フレキシブル)基板にZephyr実装してみた。
iotengineer22
0
130
徹底討論!ECS vs EKS!
daitak
3
1.1k
OTel × Datadog で 「AI活用」を計測し、改善に繋げる
shihochan
2
460
Kiro Ambassador を目指す話
k_adachi_01
0
110
自宅LLMの話
jacopen
1
690
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
600
Bash Introduction
62gerente
615
220k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Being A Developer After 40
akosma
91
590k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
The SEO identity crisis: Don't let AI make you average
varn
0
490
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
630
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Transcript
Graph databases for fun and profit Vivek Prahlad
About me
None
None
Contributor to Neo4j.rb
Multitenancy, Versioning, Performance
Author of Frankenstein
A graph primer What can you use graph databases for?
Examples (Neo4j.rb)
A graph primer What can you use graph databases for?
Examples (Neo4j.rb)
What is a graph?
A graph is an abstract representation of a set of
objects where some pairs of objects are connected by links
Graphs are all around us
Object graphs
Product Order Customer places 1: n chooses 1: n
None
None
http://tambrahmrage.tumblr.com/post/8594230361/rage-against-the-macchinar
None
None
None
None
None
None
Undirected Graph
Directed Graph
Knows Knows
Knows Knows Name: Vivek Name: Paul Name: Andy
Knows Knows Name: Vivek Name: Paul Name: Andy Since: April
2012
Knows Knows Name: Vivek Name: Paul Name: Andy Since: April
2012 Since: September 2003
What on earth is a graph database?
A database with an explicit graph structure
Each node knows it’s neighbours
Typically directed graphs
None
Two main operations
Find nodes
Either explicitly
Node[node_id]
Or use an index
Car.find(“name: Ferr*”)
Traverse, given an origin
None
Graph algorithms
Shortest path
14 2 11 15 14 9 6 9 10
Graph database options
None
None
The examples will use Neo4j
What is Neo4j?
Neo4j is an ACID compliant graph database
“Graph databases like Neo4j are an esoteric but powerful member
of the NoSQL family”
Capacity?
32 Billion nodes 32 Billion relationships 64 Billion properties
Threadsafe
Single depth transactions
Nested transactions: ‘Placebo’ transactions
Lucene integration
TWO query languages
Cypher
Gremlin
Advanced and enterprise editions for monitoring, replication, hot backup
A graph primer What can you use graph databases for?
Neo4j.rb
Typical applications
None
None
None
Recommendation systems
None
Fraud detection
Geospatial analysis
None
But
Most complex domains
Involve an object graph
A graph primer What can you use graph databases for?
Examples (Neo4j.rb)
Modeling graphs is important
None
Partitioning data crucial
Neo4j Language bindings
Java, C#, Ruby, Node.js
Embedded vs. REST server
Runs on JRuby
Builds on ActiveModel
validations, nested attributes, composed_of, all work
Built in migration support
Multitenancy support
Versioning
3 layer API
Layer 1: Nodes, Relationships
Neo4j::Transaction run do Neo4j::Node.new(:name => “A”) end
Layer 2: Node and Relationship Mixins
class SportsCar include Neo4j::NodeMixin property :brand end
Layer 3: Rails Model support
class SportsCar < Neo4j::Rails::Model property :brand end
class SportsCar < Neo4j::Rails::Model include Neo4j::Rails::Versioning property :brand end
class SportsCar < Neo4j::Rails::Model include Neo4j::Rails::Versioning property :brand, :index =>:fulltext
end
class User < Neo4j::Rails::Model attr_accessor :password attr_accessible :email, :password, :password_confirmation,
:pending_account after_save :encrypt_password email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i # add an exact lucene index on the email property property :email, :index => :exact has_one(:avatar).to(Avatar) validates :email, :presence => true,:format => { :with => email_regex } validates :email, :uniqueness => true, :unless => :pending_account? accepts_nested_attributes_for :avatar, :allow_destroy => true end
Versioning
None
None
None
None
None
Multitenancy
None
None
A few cypher examples
START a=node(3) MATCH (a)-[:KNOWS]->(b)-[:KNOWS]->(c) RETURN a,b,c
|a | b | c | |Node[3]{name->Vivek}|Node[2] |Node[3]|
START d=node(1), e=node(2) MATCH p = shortestPath( d-[*..15]->e ) RETURN
p
(1)--[KNOWS,2]-->(3)--[KNOWS,0]-->(4)--[KNOWS,3]-->(2)
In conclusion
Graphs are a compelling way to store interconnected data
No O/R mismatch
More widely applicable than you’d think
Try it out!
https://github.com/andreasronge/ neo4j.git
Thank You
@vivekprahlad
[email protected]