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. This second edition includes new code samples and diagrams, using the latest Neo4j syntax, as well as information on new functionality. 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. -- Back cover Copyright 3 Table of Contents 4 Foreword 8 Graphs Are Everywhere, or the Birth of Graph Databases as We Know Them 8 Preface 12 About the Second Edition 13 About This Book 13 Conventions Used in This Book 13 Using Code Examples 14 Safari庐 Books Online 14 How to Contact Us 15 Acknowledgments 15 Chapter 1. Introduction 18 What Is a Graph? 18 A High-Level View of the Graph Space 21 Graph Databases 22 Graph Compute Engines 24 The Power of Graph Databases 25 Performance 25 Flexibility 26 Agility 26 Summary 27 Chapter 2. Options for Storing Connected Data 28 Relational Databases Lack Relationships 28 NOSQL Databases Also Lack Relationships 32 Graph Databases Embrace Relationships 35 Summary 41 Chapter 3. Data Modeling with Graphs 42 Models and Goals 42 The Labeled Property Graph Model 43 Querying Graphs: An Introduction to Cypher 44 Cypher Philosophy 45 MATCH 47 RETURN 47 Other Cypher Clauses 48 A Comparison of Relational and Graph Modeling 49 Relational Modeling in a Systems Management Domain 50 Graph Modeling in a Systems Management Domain 55 Testing the Model 56 Cross-Domain Models 58 Creating the Shakespeare Graph 62 Beginning a Query 63 Declaring Information Patterns to Find 65 Constraining Matches 66 Processing Results 67 Query Chaining 68 Common Modeling Pitfalls 69 Email Provenance Problem Domain 69 A Sensible First Iteration? 69 Second Time鈥檚 the Charm 72 Evolving the Domain 75 Identifying Nodes and Relationships 80 Avoiding Anti-Patterns 80 Summary 81 Chapter 4. Building a Graph Database Application 82 Data Modeling 82 Describe the Model in Terms of the Application鈥檚 Needs 83 Nodes for Things, Relationships for Structure 84 Fine-Grained versus Generic Relationships 84 Model Facts as Nodes 85 Represent Complex Value Types as Nodes 88 Time 89 Iterative and Incremental Development 91 Application Architecture 93 Embedded versus Server 93 Clustering 98 Load Balancing 99 Testing 102 Test-Driven Data Model Development 102 Performance Testing 108 Capacity Planning 112 Optimization Criteria 112 Performance 113 Redundancy 115 Load 115 Importing and Bulk Loading Data 116 Initial Import 116 Batch Import 117 Summary 121 Chapter 5. Graphs in the Real World 122 Why Organizations Choose Graph Databases 122 Common Use Cases 123 Social 123 Recommendations 124 Geo 125 Master Data Management 126 Network and Data Center Management 126 Authorization and Access Control (Communications) 127 Real-World Examples 128 Social Recommendations (Professional Social Network) 128 Authorization and Access Control 140 Geospatial and Logistics 149 Summary 164 Chapter 6. Graph Database Internals 166 Native Graph Processing 166 Native Graph Storage 169 Programmatic APIs 175 Kernel API 175 Core API 176 Traversal Framework 177 Nonfunctional Characteristics 179 Transactions 179 Recoverability 180 Availability 181 Scale 183 Summary 187 Chapter 7. Predictive Analysis with Graph Theory 188 Depth- and Breadth-First Search 188 Path-Finding with Dijkstra鈥檚 Algorithm 190 The A* Algorithm 198 Graph Theory and Predictive Modeling 199 Triadic Closures 199 Structural Balance 201 Local Bridges 205 Summary 207 Appendix A. NOSQL Overview 210 The Rise of NOSQL 210 ACID versus BASE 211 The NOSQL Quadrants 213 Document Stores 213 Key-Value Stores 216 Column Family 219 Query versus Processing in Aggregate Stores 221 Graph Databases 222 Property Graphs 223 Hypergraphs 224 Triples 225 Index 228 About the Authors 236 Ian Robinson, Jim Webber & Emil Eifrem. Includes Index.