Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
The Graph Traversal Programming Pattern

                Marko A. Rodriguez
              Graph Systems Architect
        ...
Abstract
A graph is a structure composed of a set of vertices (i.e. nodes, dots)
connected to one another by a set of edge...
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Dots and Lines




There are dots and there are lines.
Lets call them vertices and edges, respectively.
Constructions from Dots and Lines




Its possible to arrange the dots and lines into various
configurations.
Lets call suc...
Dots and Lines Make a Graph
The Undirected Graph

          1. Vertices
             • All vertices denote the same
               type of object.

  ...
Denoting an Undirected Structure in the Real World




Collaborator graph is an undirected graph.   Road graph is an undir...
A Line with a Triangle




Dots and lines are boring.
Lets add a triangle to one side of each line.
However, lets call a t...
The Directed Graph

         1. Vertices
            • All vertices denote the same
              type of object.

       ...
Denoting a Directed Structure in the Real World




Twitter follow graph is a directed graph.   Web href-citation graph is...
Single Relational Structures




• Without a way to demarcate edges, all edges have the same
  meaning/type. Such structur...
How Do You Model a World with Multiple Structures?
                                                        I-25


        ...
The Limitations of the Single-Relational Graph

• A single-relational graph is only able to express a single type of verte...
The Gains of the Multi-Relational Graph
• A multi-relational graph allows for the explicit typing of edges
  (e.g. “follow...
Increasing Expressivity with Multi-Relational Graphs
                                                     cites
          ...
The Flexibility of the Property Graph
• A property graph extends a multi-relational graph by allowing for both
  vertices ...
Increasing Expressivity with Property Graphs
                                        name=neo4j
                          ...
Property Graph Instance Schema/Ontology

                  name=<string>                        name=<string>
            ...
Property Graphs Can Model Other Graph Types
                                                           weighted graph


  ...
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Persisting a Graph Data Structure

• A graph is a relatively simple data structure. It can be
  seen as the most fundament...
Representing a Graph in a Relational Database

outV | inV
------------                           A
  A   |   B
  A   |   C...
Representing a Graph in a JSON Database

{
    A : {
      out : [B, C], in : [D]              A
    }
    B : {
      in ...
Representing a Graph in an XML Database

<graphml>
  <graph>
    <node id=A />                        A
    <node id=B />
...
Defining a Graph Database



“If any database can represent a graph, then what
              is a graph database?”
Defining a Graph Database



   A graph database is any storage system that
         provides index-free adjacency.45




 ...
Defining a Graph Database

• Every element (i.e. vertex or edge) has a direct pointer to
  its adjacent element.

• No O(lo...
Defining a Graph Database by Example

            Toy Graph                Gremlin
                                     (st...
Graph Databases and Index-Free Adjacency
                                     B                    E



                  ...
Graph Databases and Index-Free Adjacency


                   B                E



        A


                   C      ...
Graph Databases and Index-Free Adjacency


                   B                E



       A


                   C       ...
Non-Graph Databases and Index-Based Adjacency

                                                       B                 E
...
Non-Graph Databases and Index-Based Adjacency


                                         B                  E



A        ...
Non-Graph Databases and Index-Based Adjacency



                                         B                  E



A       ...
Index-Free Adjacency

• While any database can implicitly represent a graph, only a
  graph database makes the graph struc...
Graph Databases Make Use of Indices




          A         B     C
                                            }    Index...
Graph Databases and Endogenous Indices

• Many indices are trees.8

• A tree is a type of constrained graph.9

• You can r...
Graph Databases and Endogenous Indices
• Graph databases allows you to explicitly model indices
  endogenous to your domai...
Graph Databases and Endogenous Indices
                                               name property index




views proper...
Graph Databases and Endogenous Indices
                                                 name property index




  views pr...
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Graph Traversals as the Foundation

• Question: Once I have my data represented as a
  graph, what can I do with it?

• An...
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Graph Database vs. Relational Database

• While any database can represent a graph, it takes time to
  make what is implic...
Neo4j vs. MySQL – Generating a Large Graph




• Generated a 1 million vertex/4 million edge graph with “natural statistic...
Neo4j vs. MySQL – The Experiment

• For each run of the experiment, a traverser (gremlin) is
  placed on a single vertex.
...
Neo4j vs. MySQL – The Experiment (Zoom-In Subset)
Neo4j vs. MySQL – The Experiment (Step 1)
Neo4j vs. MySQL – The Experiment (Step 2)
Neo4j vs. MySQL – The Experiment (Step 3)
Neo4j vs. MySQL – The Experiment (Step 4)
Neo4j vs. MySQL – The Experiment (Step 5)
Neo4j vs. MySQL – The Results
                               total running time (ms) for step traverals of length n
      ...
Neo4j vs. MySQL – More Information
For more information on this experiment, please visit
http://markorodriguez.com/Blarko/...
Why Use a Graph Database? – Data Locality

• If the solution to your problem can be represented as a local
  process withi...
Why Use a Graph Database? – Data Locality
Outline

• Graph Structures

• Graph Databases

• Graph Traversals
   Artificial Example
   Real-World Examples
Some Graph Traversal Use Cases
• Local searches — “What is in the neighborhood around
  A?”16

• Local recommendations — “...
Graph Traversals with Gremlin Programming Language




                                   Gremlin            G = (V, E)

 ...
Graph Traversals with Gremlin Programming Language



        1                created               3


              kno...
Graph Traversals with Gremlin Programming Language
                                                       vertex 3 in edge...
Graph Traversal in Property Graphs
                                    name=tobias

                         follows


   ...
Local Search: “Who are the followers of Emil Eifrem?”
                                        name=tobias

               ...
Local Search: “What webpages did Emil’s followers
                   create?”
                                        name...
Local Search: “What webpages did Emil’s followers
               followers create?”
                                      ...
Local Recommendation: “If you like webpage E, you
                  may also like...”
                                    ...
Local Recommendation: “If you like Johan, you may also
                      like...”
                                    ...
Assortment of Other Specific Graph Traversal Use Cases
• Missing friends: Find all the friends of person A. Then find all th...
Assortment of Other Specific Graph Traversal Use Cases

• Question expert identification: Find all the tags associated with
...
Some Tips on Graph Traversals

• Ranking, scoring, recommendation, searching, etc. are all
  variations on the basic theme...
Property Graph Algorithms in General
• There is a general framework for mapping all the standard single-relational
  graph...
Conclusion

• Graph databases are efficient with respects to local data
  analysis.

• Locality is defined by direct referent...
Acknowledgements

• Pavel Yaskevich for advancing Gremlin. Pavel is currently writing a
  new compiler that will make Grem...
References to Related Work
• Rodriguez, M.A., Neubauer, P., “Constructions from Dots and Lines,” Bulletin
  of the America...
Nächste SlideShare
Wird geladen in …5
×

Non-Graph Databases and Index-Based Adjacency The Graph Traversal Programming Pattern

71.585 Aufrufe

Veröffentlicht am

Non-Graph Databases and Index-Based Adjacency


B E



A B C A
B,C E D,E

D E C D




The Index (explicit) The Graph (implicit)

Veröffentlicht in: Technologie
  • I'm sleeping so much better! Hi David, just a quick message to say thank you so much for this. I have been using a CPAP machine for 3 years and I absolutely hate it. It's so uncomfortable and I sleep worse with it on than I do without it. I'm now sleeping much better thanks to your program. And my wife is so much happier too! ●●● http://ishbv.com/snoringno/pdf
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Dating direct: ❶❶❶ http://bit.ly/2Y8gKsI ❶❶❶
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Sex in your area is here: ❶❶❶ http://bit.ly/2Y8gKsI ❶❶❶
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Uterine Fibroids Cure, Discover How To Reverse And Rid, All Uterine Fibroids In 2 Months ★★★ https://bit.ly/2ONPXxg
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

×