Graph database & neo4j

33
Graph Database & Neo4j Created By: Sandip Jadhav

Transcript of Graph database & neo4j

Page 1: Graph database & neo4j

Graph Database & Neo4j

Created By: Sandip Jadhav

Page 2: Graph database & neo4j

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.

Page 3: Graph database & neo4j

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.

Page 4: Graph database & neo4j

4 © 2013 TomTom.  All rights reserved.  Confidential information.

NOSQL

Page 5: Graph database & neo4j

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

Page 6: Graph database & neo4j

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

Page 7: Graph database & neo4j

7 © 2013 TomTom.  All rights reserved.  Confidential information.

Page 8: Graph database & neo4j

8 © 2013 TomTom.  All rights reserved.  Confidential information.

Path Puzzles

Page 9: Graph database & neo4j

9 © 2013 TomTom.  All rights reserved.  Confidential information.

Mumbai Local MapGraph to represent simple map

Page 10: Graph database & neo4j

10 © 2013 TomTom.  All rights reserved.  Confidential information.

Early Adopters of Graph TechFacebook Social Graph

Page 11: Graph database & neo4j

11 © 2013 TomTom.  All rights reserved.  Confidential information.

Early Adopters of Graph TechGoogle internet graph ( Page Rank ) & Knowledge Graph

Google Knowledge Graph

Page 12: Graph database & neo4j

12 © 2013 TomTom.  All rights reserved.  Confidential information.

Graph Database& Neo4j Intro

Page 13: Graph database & neo4j

13 © 2013 TomTom.  All rights reserved.  Confidential information.

Page 14: Graph database & neo4j

14 © 2013 TomTom.  All rights reserved.  Confidential information.

Graph are Whiteboard friendly

Page 15: Graph database & neo4j

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.

Page 16: Graph database & neo4j

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)

Page 17: Graph database & neo4j

17 © 2013 TomTom.  All rights reserved.  Confidential information.

Emerging Domains to use Graph DB

Page 18: Graph database & neo4j

18 © 2013 TomTom.  All rights reserved.  Confidential information.

Neo4j

Page 19: Graph database & neo4j

19 © 2013 TomTom.  All rights reserved.  Confidential information.

Graph Db (Neo4j) Performance

Page 20: Graph database & neo4j

20 © 2013 TomTom.  All rights reserved.  Confidential information.

The Neo4J Secrete Sauce

Page 21: Graph database & neo4j

21 © 2013 TomTom.  All rights reserved.  Confidential information.

Neo4j Example : Matrix Movie

Page 22: Graph database & neo4j

22 © 2013 TomTom.  All rights reserved.  Confidential information.

Create node & relationship

Page 23: Graph database & neo4j

23 © 2013 TomTom.  All rights reserved.  Confidential information.

Transaction

Page 24: Graph database & neo4j

24 © 2013 TomTom.  All rights reserved.  Confidential information.

Define Relationship

Page 25: Graph database & neo4j

25 © 2013 TomTom.  All rights reserved.  Confidential information.

Travels Graph

Page 26: Graph database & neo4j

26 © 2013 TomTom.  All rights reserved.  Confidential information.

Result of Travelasal

Page 27: Graph database & neo4j

27 © 2013 TomTom.  All rights reserved.  Confidential information.

Neo4J Logical architecture

Page 28: Graph database & neo4j

28 © 2013 TomTom.  All rights reserved.  Confidential information.

Query language : Cypher

Page 29: Graph database & neo4j

29 © 2013 TomTom.  All rights reserved.  Confidential information.

Query language : Cypher

Page 30: Graph database & neo4j

30 © 2013 TomTom.  All rights reserved.  Confidential information.

Query language : Gremlin

• Graph travels language

• DSL (Groovy based)

Page 31: Graph database & neo4j

31 © 2013 TomTom.  All rights reserved.  Confidential information.

http://console.neo4j.org/

Page 32: Graph database & neo4j

32 © 2013 TomTom.  All rights reserved.  Confidential information.

References

• http://martinfowler.com/bliki/PolyglotPersistence.html

• http://neo4j.com

Page 33: Graph database & neo4j

Thank you

Any questions?