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
58
Other Decks in Technology
See All in Technology
iOS/Androidの二刀流エンジニアがFlutter & TypeScriptへ越境後の現在地 - Flutterがメインになって見えた景色と現在の醍醐味 / Dual-Platform Mobile Engineer Shifts to Flutter & TypeScript - The View and Real Thrill of Going Flutter-First
bitkey
PRO
0
100
【公開用】AI_Dev_Ex2026_AI_登壇資料
matsuritechnologies
PRO
2
640
Jitera Company Deck
jitera
0
570
AI時代におけるテストの基礎の再定義 / Rethinking the Fundamentals of Testing in the AI Era
mineo_matsuya
15
5.7k
「待ち時間」の消滅と「自我消耗」の加速:生成AI時代のエンジニアを救うメンタル・リソース管理
poropinai1966
0
200
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
160
Git 研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
460
変更し続けられるシステムをどう保つか — AI時代のSSoTという設計原則
kawauso
1
1.3k
ダッシュボード"開発"について 〜使われるダッシュボードのつくりかた〜
kimichan
0
230
WEBフロントエンド研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
330
Webアプリ認証の全体像 / The Big Picture of Web App Authentication
kitano_yuichi
1
450
複数プロダクトで進めるAI機能実装 ── 実践から得たリアルな学びとロードマップ実現への挑戦 / AICon2026_yanari
rakus_dev
1
310
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
1
9.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
470
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Designing Powerful Visuals for Engaging Learning
tmiket
1
460
Darren the Foodie - Storyboard
khoart
PRO
3
3.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
How STYLIGHT went responsive
nonsquared
100
6.2k
Bash Introduction
62gerente
615
220k
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]