Graph Databases

Book description

Discover how graph databases can help you manage and query highly connected data. With this practical book, you’ll learn how to design and implement a graph database that brings the power of graphs to bear on a broad range of problem domains. Whether you want to speed up your response to user queries or build a database that can adapt as your business evolves, this book shows you how to apply the schema-free graph model to real-world problems.

Learn how different organizations are using graph databases to outperform their competitors. With this book’s data modeling, query, and code examples, you’ll quickly be able to implement your own solution.

  • Model data with the Cypher query language and property graph model
  • Learn best practices and common pitfalls when modeling with graphs
  • Plan and implement a graph database solution in test-driven fashion
  • Explore real-world examples to learn how and why organizations use a graph database
  • Understand common patterns and components of graph database architecture
  • Use analytical techniques and algorithms to mine graph database information

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
    1. Graphs Are Everywhere, or the Birth of Graph Databases as We Know Them
  2. Preface
    1. About This Book
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
  3. 1. Introduction
    1. What Is a Graph?
    2. A High-Level View of the Graph Space
      1. Graph Databases
      2. Graph Compute Engines
    3. The Power of Graph Databases
      1. Performance
      2. Flexibility
      3. Agility
    4. Summary
  4. 2. Options for Storing Connected Data
    1. Relational Databases Lack Relationships
    2. NOSQL Databases Also Lack Relationships
    3. Graph Databases Embrace Relationships
    4. Summary
  5. 3. Data Modeling with Graphs
    1. Models and Goals
    2. The Property Graph Model
    3. Querying Graphs: An Introduction to Cypher
      1. Cypher Philosophy
      2. START
      3. MATCH
      4. RETURN
      5. Other Cypher Clauses
    4. A Comparison of Relational and Graph Modeling
      1. Relational Modeling in a Systems Management Domain
      2. Graph Modeling in a Systems Management Domain
      3. Testing the Model
    5. Cross-Domain Models
      1. Creating the Shakespeare Graph
      2. Beginning a Query
      3. Declaring Information Patterns to Find
      4. Constraining Matches
      5. Processing Results
      6. Query Chaining
    6. Common Modeling Pitfalls
      1. Email Provenance Problem Domain
      2. A Sensible First Iteration?
      3. Second Time’s the Charm
      4. Evolving the Domain
    7. Avoiding Anti-Patterns
    8. Summary
  6. 4. Building a Graph Database Application
    1. Data Modeling
      1. Describe the Model in Terms of the Application’s Needs
      2. Nodes for Things, Relationships for Structure
      3. Fine-Grained versus Generic Relationships
      4. Model Facts as Nodes
        1. Employment
        2. Performance
        3. Emailing
        4. Reviewing
      5. Represent Complex Value Types as Nodes
      6. Time
        1. Timeline trees
        2. Linked lists
        3. Versioning
      7. Iterative and Incremental Development
    2. Application Architecture
      1. Embedded Versus Server
        1. Embedded Neo4j
        2. Server mode
        3. Server extensions
      2. Clustering
        1. Replication
        2. Buffer writes using queues
        3. Global clusters
      3. Load Balancing
        1. Separate read traffic from write traffic
        2. Cache sharding
        3. Read your own writes
    3. Testing
      1. Test-Driven Data Model Development
        1. Example: A test-driven social network data model
        2. Testing server extensions
      2. Performance Testing
        1. Query performance tests
        2. Application performance tests
        3. Testing with representative data
    4. Capacity Planning
      1. Optimization Criteria
      2. Performance
        1. Calculating the cost of graph database performance
        2. Performance optimization options
      3. Redundancy
      4. Load
    5. Summary
  7. 5. Graphs in the Real World
    1. Why Organizations Choose Graph Databases
    2. Common Use Cases
      1. Social
      2. Recommendations
      3. Geo
      4. Master Data Management
      5. Network and Data Center Management
      6. Authorization and Access Control (Communications)
    3. Real-World Examples
      1. Social Recommendations (Professional Social Network)
        1. Talent.net data model
        2. Inferring social relations
        3. Finding colleagues with particular interests
        4. Adding WORKED_WITH relationships
      2. Authorization and Access Control
        1. TeleGraph data model
        2. Finding all accessible resources for an administrator
        3. Determining whether an administrator has access to a resource
        4. Finding administrators for an account
      3. Geo (Logistics)
        1. Global Post data model
        2. Route calculation
        3. Finding the shortest delivery route using Cypher
        4. Implementing route calculation with the traversal framework
    4. Summary
  8. 6. Graph Database Internals
    1. Native Graph Processing
    2. Native Graph Storage
    3. Programmatic APIs
      1. Kernel API
      2. Core (or “Beans”) API
      3. Traversal API
    4. Nonfunctional Characteristics
      1. Transactions
      2. Recoverability
      3. Availability
      4. Scale
        1. Capacity
        2. Latency
        3. Throughput
    5. Summary
  9. 7. Predictive Analysis with Graph Theory
    1. Depth- and Breadth-First Search
    2. Path-Finding with Dijkstra’s Algorithm
    3. The A* Algorithm
    4. Graph Theory and Predictive Modeling
      1. Triadic Closures
      2. Structural Balance
    5. Local Bridges
    6. Summary
  10. A. NOSQL Overview
    1. The Rise of NOSQL
    2. ACID versus BASE
    3. The NOSQL Quadrants
    4. Document Stores
    5. Key-Value Stores
    6. Column Family
    7. Query versus Processing in Aggregate Stores
    8. Graph Databases
      1. Property Graphs
      2. Hypergraphs
      3. Triples
  11. Index
  12. About the Authors
  13. Colophon
  14. Copyright

Product information

  • Title: Graph Databases
  • Author(s): Jim Webber, Emil Eifrem, Ian Robinson
  • Release date: June 2013
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449356262