SlideShare a Scribd company logo
On Graph Databases



  Pere Urbón Bayes
         purbon@purbon.com


        May of 2010



   BcnOnRails May - 2010 - On Graph Databases   1
On Graph Databases

●   NoSQL movement.
●   Graph databases.
●   Pros and cons.
●   Use cases.
●   Technology overview.
●   Example.


                 BcnOnRails May - 2010 - On Graph Databases   2
NoSQL Movement

●   Next Generation of Databases.
●   Innovative. (?)
●   Open Source. (?)
●   Non-Relational.
●   Schema-less.
●   Distributed.
●   Scalable.



                      BcnOnRails May - 2010 - On Graph Databases   3
NoSQL Movement

●   Stores.                                  ●   More Stores.
        –   Document.                                    –   Grid database.
        –   Key/Value.                                   –   XML Database.
        –   Object oriented.                             –   RDF.
        –   Column.                                      –   .....
        –   Graph database.




                      BcnOnRails May - 2010 - On Graph Databases              4
NoSQL Movement

●   NoSQL is not the holy grail, never forget it.
●   Precursors & roots begun at the early 70's.
        –   Network databases, Charles Bachman 1969.




    案ずるより産むが易し。
               –   Giving birth to a baby is easier than worrying about it.



                         BcnOnRails May - 2010 - On Graph Databases           5
Graph Databases

●   Data strongly related.
        –   Social networks.
        –   GIS Systems.
        –   Transportation.
        –   Bibliographic.
        –   File systems.
        –   ........

                                                       GitHub Ruby community by country


                         BcnOnRails May - 2010 - On Graph Databases                       6
Graph Databases

●   The Property Graph.
        –   Labeled.
        –   Directed.
        –   Attributed.
        –   Multigraph.
●   Talk about.
        –   Nodes with types.
        –   Edges with types.
        –   Attributes.
                          BcnOnRails May - 2010 - On Graph Databases   7
Graph Databases

●   Graph storage.
       –   Adjacency Matrix.
       –   Adjacency List.
       –   Incidence Matrix.
       –   Incidence List.
●   GraphDB's.
       –   Bitmaps.
       –   B+Trees.
       –   RB Trees.
                       BcnOnRails May - 2010 - On Graph Databases   8
Graph Databases

                                                        Query           MySQL      OIM      DEX

                                                   Q1:count              20,38     17,35      0

            RDBMS       OIM            DEX         Q2:scan               32,76    174,64     3,14

  data      27.36 GB   54 GB         9.69 GB       Q3:select              7,34     5,43      0,84

                                                   Q4:projection         17,34     43,7     33,19
  ratio       10,9      21,51          3,86
overhead                                           Q5:combine             0,74     2,61      0,01
load time   52891 s    17543 s       95579 s
                                                   Q6:explode             0,07    202,07     0,01

                                                   Q7:values             12,28     20,77     0,01

                                                   Q8:hub               >3hours   >3hours   624,68



                                 BcnOnRails May - 2010 - On Graph Databases                       9
Graph Databases




  BcnOnRails May - 2010 - On Graph Databases   10
Use cases

●   Network analysis.
●   Link analysis.
●   Graph mining.
●   Neural networks.
●   Bibliographic search.
●   Semantic web.


                 BcnOnRails May - 2010 - On Graph Databases   11
Use cases

●   Algorithmic recruitment with GitHub.
       –   Centrality: The importance of a vertex within a
            graph.
               ●   Betweens: Vertex that occur on many shortest
                    path have higher centrality.
                        –   O(v^3) without any optimization.

               ●   Another possible choices:
                        –   Closeness: Vertex with a short geodesic distance
                              to other ones have a high closeness.
                                  ● Usually preferred on network analysis.




                       BcnOnRails May - 2010 - On Graph Databases              12
Graph Databases

●   Shortest Paths.                            ●   Centrality.
        –   BFS/DFS.                                       –   Betweenness.
        –   Dijkstra.                                      –   Closeness.
        –   Floyd-Warshall.                                –   Diameter.
        –   Ford.                                          –   Radius.
●   Connectivity.                              ●   Traversals.
        –   Strongly connected.                            –   BFS/DFS.
        –   Weakly connected.                  ●   Communities.
                                               ●   Staining.
                        BcnOnRails May - 2010 - On Graph Databases            13
Pros and cons

●   Data facts.                             ●   Relational model facts.
        –   Growths                                     –   E.F Codd model.
             exponentially.                             –   Normalization.
        –   Hugh                                        –   Object-Relational
             interdependency                                 impedance
             and complexity.                                 mismatch.
        –   Relationships are                           –   Join's doesn't scale.
             important.
                                                        –   Big tables.
        –   Structure change
              over time.                                –   Denormalization.

                     BcnOnRails May - 2010 - On Graph Databases                 14
Technology overview

●   Neo4J: Open source database NoSQL graph.
●   Dex: The high performance graph database.
●   HyperGraphDB: An IA and semantic web
     graph database.
●   Infogrid: The Internet Graph database.
●   Sones: SaaS dot Net Graph database.
●   VertexDB: High performance database server.

                 BcnOnRails May - 2010 - On Graph Databases   15
Benchmarking

Kernel      Scale 15   DEX        Neo4j        Jena      HypergraphDB
K1 Load (s)               7,44        697         141 +24h

K2 Scan edges (s)       0,0010       2,71        0,689
K3 2-hops (s)           0,0120     0,0260        0,443
                                                          Kernel           DEX          Neo4j     Jena     Hypergr
K4 BC (s)                 14,8       8,24         138                                                      aphDB
                                                                Scale 20
Db size (MB)                 30           17      207     K1 Load (s)             317    32.094    4.560 +24h

                                                          K2 Scan           0,005           751     18,6
 Graph Database Performance on the                        edges (s)
 HPC Scalable Graph Analysis Benchmark                    K3 2-hops (s)     0,033        0,0230 0,4580
                                                          K4 BC (s)               617     7.027 59.512

                                                          Db size (MB)            893       539    6.656


                                     BcnOnRails May - 2010 - On Graph Databases                              16
Technology overview




    BcnOnRails May - 2010 - On Graph Databases   17
Technology overview
●   Neo4J.rb ( JRuby target )
        –   Active record integration.
        –   Dynamic and schema free.
        –   Fast traversal of relationships.
        –   Transactions with rollbacks support.
        –   Indexing and querying of ruby objects.
        –   Massive loaders.
                                   http://wiki.neo4j.org/content/Ruby
        –   Ruby on Rails integration.
        –   Accessible throw REST.

                        BcnOnRails May - 2010 - On Graph Databases   18
Technology overview
    Creating nodes                                Properties
 require "rubygems"                        node = Neo4j::Node.new
 require 'neo4j'                           node[:name] = 'foo'
                                           node[:age] = 123
 Neo4j::Transaction.run do                 node[:hungry] = false
  node = Neo4j::Node.new                   node[4] = 3.14
 end                                       node[:age] # => 123

 Transactions over blocks                    Creating relationships

Neo4j::Transaction.run do                node1 = Neo4j::Node.new
  # neo4j operations goes here           node2 = Neo4j::Node.new
 end                                     Neo4j::Relationship.new(:friends, node1, node2)

                                         # which is same as
                                         node1.rels.outgoing(:friends) << node2



                             BcnOnRails May - 2010 - On Graph Databases                    19
Technology overview
 Accessing relationships
node1.rels.empty? # => false

# The rels method returns an enumeration of relationship objects.
# The nodes method on the relationships returns the nodes instead.
node1.rels.nodes.include?(node2) # => true

node1.rels.first # => the first relationship this node1 has.
node1.rels.nodes.first # => node2 first node of any relationship type
node2.rels.incoming(:friends).nodes.first # => node1 first node of relationship type 'friends'
node2.rels.incoming(:friends).first # => a relationship object between node1 and node2

 Properties on Relationships
rel = node1.rels.outgoing(:friends).first

rel[:since] = 1982
node1.rels.first[:since] # => 1982

                               BcnOnRails May - 2010 - On Graph Databases                  20
Example



For the joy of someone, lets play a little with a
                graph database.




               BcnOnRails May - 2010 - On Graph Databases   21
On Graph Databases




    Thanks you!
    Pere Urbón Bayes
         purbon@purbon.com




   BcnOnRails May - 2010 - On Graph Databases   22

More Related Content

PDF
Modèles de données et langages de description ouverts 6 - 2021-2022
PPTX
Exchange and Consumption of Huge RDF Data
KEY
History and Background of the USEWOD Data Challenge
PDF
Cooking Software101
PDF
Python Meetup Talk 21072009
PDF
GraphDevRoom Call for Sponsors
PPT
How can your community’s plan yield federal dollars?
PDF
test
Modèles de données et langages de description ouverts 6 - 2021-2022
Exchange and Consumption of Huge RDF Data
History and Background of the USEWOD Data Challenge
Cooking Software101
Python Meetup Talk 21072009
GraphDevRoom Call for Sponsors
How can your community’s plan yield federal dollars?
test

Viewers also liked (6)

PPTX
Advantages in Place: Federal Funding
PDF
Graph Databases introduction to rug-b
PDF
Try NoSQL it doesn't hurts and is fun
PDF
Graph Databases, The Web of Data Storage Engines
PDF
Graph Theory and Databases
PDF
Study: The Future of VR, AR and Self-Driving Cars
Advantages in Place: Federal Funding
Graph Databases introduction to rug-b
Try NoSQL it doesn't hurts and is fun
Graph Databases, The Web of Data Storage Engines
Graph Theory and Databases
Study: The Future of VR, AR and Self-Driving Cars
Ad

Similar to Bcn On Rails May2010 On Graph Databases (20)

PPTX
Anti-social Databases
KEY
Spring Data Neo4j Intro SpringOne 2011
PPTX
Drill njhug -19 feb2013
ODP
Grails goes Graph
PPTX
An Introduction to Big Data, NoSQL and MongoDB
PDF
Django and Neo4j - Domain modeling that kicks ass
KEY
NOSQL, CouchDB, and the Cloud
PDF
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
PDF
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
PPTX
RTree Spatial Indexing with MongoDB - MongoDC
PPTX
Big data hadoop-no sql and graph db-final
PPTX
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
PPTX
CSC 8101 Non Relational Databases
PDF
Data-Intensive Text Processing with MapReduce
PDF
Data-Intensive Text Processing with MapReduce
PDF
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
PDF
Relational vs. Non-Relational
PPTX
NoSQL & Big Data Analytics: History, Hype, Opportunities
KEY
DevNation Atlanta
PDF
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
Anti-social Databases
Spring Data Neo4j Intro SpringOne 2011
Drill njhug -19 feb2013
Grails goes Graph
An Introduction to Big Data, NoSQL and MongoDB
Django and Neo4j - Domain modeling that kicks ass
NOSQL, CouchDB, and the Cloud
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
RTree Spatial Indexing with MongoDB - MongoDC
Big data hadoop-no sql and graph db-final
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
CSC 8101 Non Relational Databases
Data-Intensive Text Processing with MapReduce
Data-Intensive Text Processing with MapReduce
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
Relational vs. Non-Relational
NoSQL & Big Data Analytics: History, Hype, Opportunities
DevNation Atlanta
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
Ad

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation theory and applications.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
A Presentation on Artificial Intelligence
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Cloud computing and distributed systems.
Digital-Transformation-Roadmap-for-Companies.pptx
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation theory and applications.pdf
Electronic commerce courselecture one. Pdf
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
“AI and Expert System Decision Support & Business Intelligence Systems”
A Presentation on Artificial Intelligence
Unlocking AI with Model Context Protocol (MCP)
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Bcn On Rails May2010 On Graph Databases

  • 1. On Graph Databases Pere Urbón Bayes purbon@purbon.com May of 2010 BcnOnRails May - 2010 - On Graph Databases 1
  • 2. On Graph Databases ● NoSQL movement. ● Graph databases. ● Pros and cons. ● Use cases. ● Technology overview. ● Example. BcnOnRails May - 2010 - On Graph Databases 2
  • 3. NoSQL Movement ● Next Generation of Databases. ● Innovative. (?) ● Open Source. (?) ● Non-Relational. ● Schema-less. ● Distributed. ● Scalable. BcnOnRails May - 2010 - On Graph Databases 3
  • 4. NoSQL Movement ● Stores. ● More Stores. – Document. – Grid database. – Key/Value. – XML Database. – Object oriented. – RDF. – Column. – ..... – Graph database. BcnOnRails May - 2010 - On Graph Databases 4
  • 5. NoSQL Movement ● NoSQL is not the holy grail, never forget it. ● Precursors & roots begun at the early 70's. – Network databases, Charles Bachman 1969. 案ずるより産むが易し。 – Giving birth to a baby is easier than worrying about it. BcnOnRails May - 2010 - On Graph Databases 5
  • 6. Graph Databases ● Data strongly related. – Social networks. – GIS Systems. – Transportation. – Bibliographic. – File systems. – ........ GitHub Ruby community by country BcnOnRails May - 2010 - On Graph Databases 6
  • 7. Graph Databases ● The Property Graph. – Labeled. – Directed. – Attributed. – Multigraph. ● Talk about. – Nodes with types. – Edges with types. – Attributes. BcnOnRails May - 2010 - On Graph Databases 7
  • 8. Graph Databases ● Graph storage. – Adjacency Matrix. – Adjacency List. – Incidence Matrix. – Incidence List. ● GraphDB's. – Bitmaps. – B+Trees. – RB Trees. BcnOnRails May - 2010 - On Graph Databases 8
  • 9. Graph Databases Query MySQL OIM DEX Q1:count 20,38 17,35 0 RDBMS OIM DEX Q2:scan 32,76 174,64 3,14 data 27.36 GB 54 GB 9.69 GB Q3:select 7,34 5,43 0,84 Q4:projection 17,34 43,7 33,19 ratio 10,9 21,51 3,86 overhead Q5:combine 0,74 2,61 0,01 load time 52891 s 17543 s 95579 s Q6:explode 0,07 202,07 0,01 Q7:values 12,28 20,77 0,01 Q8:hub >3hours >3hours 624,68 BcnOnRails May - 2010 - On Graph Databases 9
  • 10. Graph Databases BcnOnRails May - 2010 - On Graph Databases 10
  • 11. Use cases ● Network analysis. ● Link analysis. ● Graph mining. ● Neural networks. ● Bibliographic search. ● Semantic web. BcnOnRails May - 2010 - On Graph Databases 11
  • 12. Use cases ● Algorithmic recruitment with GitHub. – Centrality: The importance of a vertex within a graph. ● Betweens: Vertex that occur on many shortest path have higher centrality. – O(v^3) without any optimization. ● Another possible choices: – Closeness: Vertex with a short geodesic distance to other ones have a high closeness. ● Usually preferred on network analysis. BcnOnRails May - 2010 - On Graph Databases 12
  • 13. Graph Databases ● Shortest Paths. ● Centrality. – BFS/DFS. – Betweenness. – Dijkstra. – Closeness. – Floyd-Warshall. – Diameter. – Ford. – Radius. ● Connectivity. ● Traversals. – Strongly connected. – BFS/DFS. – Weakly connected. ● Communities. ● Staining. BcnOnRails May - 2010 - On Graph Databases 13
  • 14. Pros and cons ● Data facts. ● Relational model facts. – Growths – E.F Codd model. exponentially. – Normalization. – Hugh – Object-Relational interdependency impedance and complexity. mismatch. – Relationships are – Join's doesn't scale. important. – Big tables. – Structure change over time. – Denormalization. BcnOnRails May - 2010 - On Graph Databases 14
  • 15. Technology overview ● Neo4J: Open source database NoSQL graph. ● Dex: The high performance graph database. ● HyperGraphDB: An IA and semantic web graph database. ● Infogrid: The Internet Graph database. ● Sones: SaaS dot Net Graph database. ● VertexDB: High performance database server. BcnOnRails May - 2010 - On Graph Databases 15
  • 16. Benchmarking Kernel Scale 15 DEX Neo4j Jena HypergraphDB K1 Load (s) 7,44 697 141 +24h K2 Scan edges (s) 0,0010 2,71 0,689 K3 2-hops (s) 0,0120 0,0260 0,443 Kernel DEX Neo4j Jena Hypergr K4 BC (s) 14,8 8,24 138 aphDB Scale 20 Db size (MB) 30 17 207 K1 Load (s) 317 32.094 4.560 +24h K2 Scan 0,005 751 18,6 Graph Database Performance on the edges (s) HPC Scalable Graph Analysis Benchmark K3 2-hops (s) 0,033 0,0230 0,4580 K4 BC (s) 617 7.027 59.512 Db size (MB) 893 539 6.656 BcnOnRails May - 2010 - On Graph Databases 16
  • 17. Technology overview BcnOnRails May - 2010 - On Graph Databases 17
  • 18. Technology overview ● Neo4J.rb ( JRuby target ) – Active record integration. – Dynamic and schema free. – Fast traversal of relationships. – Transactions with rollbacks support. – Indexing and querying of ruby objects. – Massive loaders. http://wiki.neo4j.org/content/Ruby – Ruby on Rails integration. – Accessible throw REST. BcnOnRails May - 2010 - On Graph Databases 18
  • 19. Technology overview Creating nodes Properties require "rubygems" node = Neo4j::Node.new require 'neo4j' node[:name] = 'foo' node[:age] = 123 Neo4j::Transaction.run do node[:hungry] = false node = Neo4j::Node.new node[4] = 3.14 end node[:age] # => 123 Transactions over blocks Creating relationships Neo4j::Transaction.run do node1 = Neo4j::Node.new # neo4j operations goes here node2 = Neo4j::Node.new end Neo4j::Relationship.new(:friends, node1, node2) # which is same as node1.rels.outgoing(:friends) << node2 BcnOnRails May - 2010 - On Graph Databases 19
  • 20. Technology overview Accessing relationships node1.rels.empty? # => false # The rels method returns an enumeration of relationship objects. # The nodes method on the relationships returns the nodes instead. node1.rels.nodes.include?(node2) # => true node1.rels.first # => the first relationship this node1 has. node1.rels.nodes.first # => node2 first node of any relationship type node2.rels.incoming(:friends).nodes.first # => node1 first node of relationship type 'friends' node2.rels.incoming(:friends).first # => a relationship object between node1 and node2 Properties on Relationships rel = node1.rels.outgoing(:friends).first rel[:since] = 1982 node1.rels.first[:since] # => 1982 BcnOnRails May - 2010 - On Graph Databases 20
  • 21. Example For the joy of someone, lets play a little with a graph database. BcnOnRails May - 2010 - On Graph Databases 21
  • 22. On Graph Databases Thanks you! Pere Urbón Bayes purbon@purbon.com BcnOnRails May - 2010 - On Graph Databases 22