graph database & neo4j
TRANSCRIPT
Graph Database & Neo4j
Created By: Sandip Jadhav
2 © 2013 TomTom. All rights reserved. Confidential information.
Puzzle
Traces through all the edges of a graph without lifting one’s pencil and without retracing any edge more than once
1. 2. 3.
4. 5. 6.
3 © 2013 TomTom. All rights reserved. Confidential information.
Euler path
• An Euler path is a path that uses every edge of a graph exactly once.
• Seven Bridges of Königsberg is a historically notable problem in mathematics
• Theorem: An Eulerian trail exists in a connected graph if and only if there are either no odd vertices or two odd vertices.
4 © 2013 TomTom. All rights reserved. Confidential information.
NOSQL
5 © 2013 TomTom. All rights reserved. Confidential information.
Four NOSQL Categories
• Key-value stores
• Based On Amazon’s Dynamo Paper
• Data model : (global) collection of K-V pairs
• Example : Riak, Voldemort, Redis
• Column-Family
• Based on Google’s BigTable paper
• Data Model: big table, column families
• Example : Hbase, Hypertable, Cassandra
6 © 2013 TomTom. All rights reserved. Confidential information.
Four NOSQL Categories
• Document Databases
• Inspired by Lotus Notes
• Data model : collection of K-V Collection
• Example : CouchDB, MongoDB
• Graph Databases
• Inspired by Euler & graph theory
• Data Model: nodes, relationship
• Example : AllegroGraph,Sones,Neo4j
7 © 2013 TomTom. All rights reserved. Confidential information.
8 © 2013 TomTom. All rights reserved. Confidential information.
Path Puzzles
9 © 2013 TomTom. All rights reserved. Confidential information.
Mumbai Local MapGraph to represent simple map
10 © 2013 TomTom. All rights reserved. Confidential information.
Early Adopters of Graph TechFacebook Social Graph
11 © 2013 TomTom. All rights reserved. Confidential information.
Early Adopters of Graph TechGoogle internet graph ( Page Rank ) & Knowledge Graph
Google Knowledge Graph
12 © 2013 TomTom. All rights reserved. Confidential information.
Graph Database& Neo4j Intro
13 © 2013 TomTom. All rights reserved. Confidential information.
14 © 2013 TomTom. All rights reserved. Confidential information.
Graph are Whiteboard friendly
15 © 2013 TomTom. All rights reserved. Confidential information.
Top Reasons choose Graph database
• Problems with Join performance.• Continuously evolving data set (often
involves wide and sparse tables)• The Shape of Domain is naturally a
graph• Open-ended business requirements
necessitating fast, iterative development.
16 © 2013 TomTom. All rights reserved. Confidential information.
Graph Databases are Designed to:
• Highly connected data (social networks)
• Make sense of that data
• 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)
17 © 2013 TomTom. All rights reserved. Confidential information.
Emerging Domains to use Graph DB
18 © 2013 TomTom. All rights reserved. Confidential information.
Neo4j
19 © 2013 TomTom. All rights reserved. Confidential information.
Graph Db (Neo4j) Performance
20 © 2013 TomTom. All rights reserved. Confidential information.
The Neo4J Secrete Sauce
21 © 2013 TomTom. All rights reserved. Confidential information.
Neo4j Example : Matrix Movie
22 © 2013 TomTom. All rights reserved. Confidential information.
Create node & relationship
23 © 2013 TomTom. All rights reserved. Confidential information.
Transaction
24 © 2013 TomTom. All rights reserved. Confidential information.
Define Relationship
25 © 2013 TomTom. All rights reserved. Confidential information.
Travels Graph
26 © 2013 TomTom. All rights reserved. Confidential information.
Result of Travelasal
27 © 2013 TomTom. All rights reserved. Confidential information.
Neo4J Logical architecture
28 © 2013 TomTom. All rights reserved. Confidential information.
Query language : Cypher
29 © 2013 TomTom. All rights reserved. Confidential information.
Query language : Cypher
30 © 2013 TomTom. All rights reserved. Confidential information.
Query language : Gremlin
• Graph travels language
• DSL (Groovy based)
31 © 2013 TomTom. All rights reserved. Confidential information.
http://console.neo4j.org/
32 © 2013 TomTom. All rights reserved. Confidential information.
References
• http://martinfowler.com/bliki/PolyglotPersistence.html
• http://neo4j.com
Thank you
Any questions?