This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)(Learn how and when to remove this template message)
In computing, a graph database (GDB) is a database that uses graph structures for semantic queries with nodes, edges and properties to represent and store data. A key concept of the system is the graph (or edge or relationship), which directly relates data items in the store. The relationships allow data in the store to be linked together directly, and in many cases retrieved with one operation.
This contrasts with relational databases that, with the aid of relational database management systems, permit managing the data without imposing implementation aspects like physical record chains; for example, links between data are stored in the database itself at the logical level, and relational algebra operations (e.g. join) can be used to manipulate and return related data in the relevant logical format. The execution of relational queries is possible with the aid of the database management systems at the physical level (e.g. using indexes), which permits boosting performance without modifying the logical structure of the database.
Graph databases, by design, allow simple and fast retrieval of complex hierarchical structures that are difficult to model[according to whom?] in relational systems. Graph databases are similar to 1970s network model databases in that both represent general graphs, but network-model databases operate at a lower level of abstraction and lack easy traversal over a chain of edges.
The underlying storage mechanism of graph databases can vary. Some depend on a relational engine and “store” the graph data in a table (although a table is a logical element, therefore this approach imposes another level of abstraction between the graph database, the graph database management system and the physical devices where the data is actually stored). Others use a key-value store or document-oriented database for storage, making them inherently NoSQL structures. Most[according to whom?] graph databases based on non-relational storage engines also add the concept of tags or properties, which are essentially relationships having a pointer to another document. This allows data elements to be categorized for easy retrieval en masse.
Retrieving data from a graph database requires a query language other than SQL, which was designed for the manipulation of data in a relational system and therefore cannot “elegantly” handle traversing a graph. As of 2017[update], no single graph query language has been universally adopted in the same way as SQL was for relational databases, and there are a wide variety of systems, most often tightly tied to one product. Some standardization efforts have occurred, leading to multi-vendor query languages like Gremlin, SPARQL, and Cypher. In addition to having query language interfaces, some graph databases are accessed through application programming interfaces (APIs).
Graph databases are based on graph theory, and employ nodes, edges, and properties.
- Nodes represent entities such as people, businesses, accounts, or any other item to be tracked. They are roughly the equivalent of the record, relation, or row in a relational database, or the document in a document database.
- Edges, also termed graphs or relationships, are the lines that connect nodes to other nodes; they represent the relationship between them. Meaningful patterns emerge when examining the connections and interconnections of nodes, properties, and edges. Edges are the key concept in graph databases, representing an abstraction that is not directly implemented in other systems.
- Properties are germane information to nodes. For example, if Wikipedia were one of the nodes, it might be tied to properties such as website, reference material, or words that starts with the letter w, depending on which aspects of Wikipedia are germane to a given database.
The relational model gathers data together using information in the data. For example, one might look for all the "users" whose phone number contains the area code "311". This would be done by searching selected datastores, or tables, looking in the selected phone number fields for the string "311". This can be a time consuming process in large tables, so relational databases offer the concept of a database index, which allows data like this to be stored in a smaller subtable, containing only the selected data and a unique key (or primary key) of the record it is part of. If the phone numbers are indexed, the same search would occur in the smaller index table, gathering the keys of matching records, and then looking in the main data table for the records with those keys. Generally, the tables are physically stored so that lookups on these keys are fast.
Relational databases do not inherently contain the idea of fixed relationships between records. Instead, related data is linked to each other by storing one record's unique key in another record's data. For example, a table containing email addresses for users might hold a data item called
userpk, which contains the primary key of the user record it is associated with. In order to link users and their email addresses, the system first looks up the selected user records primary keys, looks for those keys in the
userpk column in the email table (or more likely, an index of them), extracts the email data, and then links the user and email records to make composite records containing all the selected data. This operation, termed a join, can be computationally costly. Depending on the complexity of the query, the number of joins, and the indexing of the various keys, the system may have to search through multiple tables and indexes, gather lots of information, and then sort it all to match it together.
In contrast, graph databases directly store the relationships between records. Instead of an email address being found by looking up its user's key in the
userpk column, the user record has a pointer directly to the email address record. That is, having selected a user, the pointer can be followed directly to the email records, there is no need to search the email table to find the matching records. This can eliminate the costly join operations. For example, if one searches for all of the email addresses for users in area code "311", the engine would first perform a conventional search to find the users in "311", but then retrieve the email addresses by following the links found in those records. A relational database would first find all the users in "311", extract a list of the pk's, perform another search for any records in the email table with those pk's, and link the matching records together. For these types of common operations, a graph database (in theory at least) is significantly faster.
The true value of the graph approach becomes evident when one performs searches that are more than one level deep. For example, consider a search for users who have "subscribers" (a table linking users to other users) in the "311" area code. In this case a relational database has to first look for all the users with an area code in "311", then look in the subscribers table for any of those users, and then finally look in the users table to retrieve the matching users. In contrast, a graph database would look for all the users in "311", then follow the back-links through the subscriber relationship to find the subscriber users. This avoids several searches, lookups and the memory involved in holding all of the temporary data from multiple records needed to construct the output. Technically, this sort of lookup is completed in O(log(n)) + O(1) time, that is, roughly relative to the logarithm of the size of the data. In contrast, the relational version would be multiple O(log(n)) lookups, plus more time to join all the data.
The relative advantage of graph retrieval grows with the complexity of a query. For example, one might want to know "that movie about submarines with the actor who was in that movie with that other actor that played the lead in Gone With the Wind". This first requires the system to find the actors in Gone With the Wind, find all the movies they were in, find all the actors in all of those movies who were not the lead in Gone With the Wind, and then find all of the movies they were in, finally filtering that list to those with descriptions containing "submarine". In a relational database this will require several separate searches through the movies and actors tables, doing another search on submarine movies, finding all the actors in those movies, and then comparing the (large) collected results. In contrast, the graph database would simply walk from Gone With the Wind to Clark Gable, gather the links to the movies he has been in, gather the links out of those movies to other actors, and then follow the links out of those actors back to the list of movies. The resulting list of movies can then be searched for "submarine". All of this can be done via one search.
Properties add another layer of abstraction to this structure that also improves many common queries. Properties are essentially labels that can be applied to any record, or in some cases, edges also. For example, one might label Clark Gable as "actor", which would then allow the system to quickly find all the records that are actors, as opposed to director or camera operator. If labels on edges are allowed, one could also label the relationship between Gone With the Wind and Clark Gable as "lead", and by performing a search on people that are "lead" "actor" in the movie Gone With the Wind, the database would produce Vivien Leigh, Olivia de Havilland and Clark Gable. The equivalent SQL query would have to rely on added data in the table linking people and movies, adding more complexity to the query syntax. These sorts of labels may improve search performance under certain circumstances, but are generally more useful in providing added semantic data for end users.
Relational databases are very well suited to flat data layouts, where relationships between data is one or two levels deep. For example, an accounting database might need to look up all the line items for all the invoices for a given customer, a three-join query. Graph databases are aimed at datasets that contain many more links. They are especially well suited to social networking systems, where the "friends" relationship is essentially unbounded. These properties make graph databases naturally suited to types of searches that are increasingly common in online systems, and in big data environments. For this reason, graph databases are becoming very popular for large online systems like Facebook, Google, Twitter, and similar systems with deep links between records.
Compared with relational databases, graph databases are often faster for associative data sets and map more directly to the structure of object-oriented applications. They can scale more naturally to large data sets as they do not typically need costly join operations (here costly means when executed on databases with non-optimal designs at the logical and physical levels). As they depend less on a rigid schema, they are marketed as more suitable to manage ad hoc and changing data with evolving schemas. Conversely, relational database management systems are typically faster at performing the same operation on large numbers of data elements, permitting the manipulation of the data in its natural structure.
Graph databases are a powerful tool for graph-like queries. For example, computing the shortest path between two nodes in the graph. Other graph-like queries can be performed over a graph database in a natural way (for example graph's diameter computations or community detection).
In the pre-history of graph databases, in the mid-1960s Navigational databases such as IBM's IMS supported tree-like structures in its hierarchical model, but the strict tree structure could be circumvented with virtual records.
Several improvements to graph databases appeared in the early 1990s, accelerating in the late 1990s with endeavors to index web pages.
In the 2010s, commercial ACID graph databases that could be scaled horizontally became available. Further, SAP HANA brought in-memory and columnar technologies to graph databases. Also in the 2010s, multi-model databases that supported graph models (and other models such as relational database or document-oriented database) became available, such as OrientDB, ArangoDB, and MarkLogic (starting with its 7.0 version). During this time, graph databases of various types have become especially popular with social network analysis with the advent of social media companies.
List of graph databases
The following is a list of notable graph databases:
|AgensGraph||1.3.1 (March 2018)||Free, Apache 2||C||Hybrid-database integrated with Relational database and Graph database. SQL and Cypher can be used in the same query in AgensGraph.|
|AllegroGraph||5.1 (May 2015)||Proprietary, clients: Eclipse Public License v1||C#, C, Common Lisp, Java, Python||Resource Description Framework (RDF) and graph database|
|AnzoGraph||4.0 (February 2018)||Proprietary||C, C++||AnzoGraph is a Massively parallel native graph GOLAP (Graph Online Analytics Processing) style database built to support complex SPARQL join queries and analyze trillions of relationships. AnzoGraph is designed for interactive analysis of broad swaths of RDF data, accumulated over weeks or years of transactions, possibly from many disparate GOLTP and other database sources.|
|Blazegraph||2.1 (April 2016)||commercial, or GPLv2 for evaluation||Java||RDF-graph database capable of clustered deployment and graphics processing unit (GPU), in commercial version; supports high availability (HA) mode, embedded mode, single server mode. Supports the Blueprints and SPARQL.|
|Cayley||0.7.3 (April 2018)||Free, Apache 2||Go||Graph database|
|Dgraph||1.0.4 (March 2018)||Free, Apache 2||Go||Open source, scalable, distributed, highly available, transactional and fast graph database, designed from ground up to be run at web scale.|
|DataStax Enterprise Graph||v6.0.1 (June 2018)||Proprietary||Java||Distributed, real-time, scalable database inspired by Titan; supports Tinkerpop and integrates with Cassandra|
|FlureeDB||V1 Beta||Free, Proprietary||GraphQL, FlureeQL||Graph Database that enables Blockchain-backed applications. ACID compliant; built for distributed ledger applications.|
|GraphBase||1.0.03b||Proprietary, commercial||Java||A customizable, distributed, small size graph store with a rich tool set from FactNexus.|
|gStore||0.4.1 (March 2017)||BSD-3||C++||An engine to manage large graph-structured data; open-source for Linux operating systems; written fully in C++, with some libraries such as readline, antlr, etc.; use modes: native, server-client, or distributed.|
|InfiniteGraph||3.0 (January 2013)||Proprietary, commercial||Java||Distributed and cloud-enabled|
|JanusGraph||0.2.0 (October 2017)||Free, Apache 2||Java||Distributed graph database forked from Titan|
|MarkLogic||8.0.4 (2015)||Proprietary, freeware developer version||Java||Multi-model NoSQL database that stores documents (JSON and XML) and semantic graph data (RDF triples); also has a built-in search engine and a full-list of enterprise features such as ACID transactions, high availability and disaster recovery, certified security, scalability, and elasticity|
|Microsoft SQL Server 2017||RC1||Proprietary||SQL/T-SQL, R, Python||Offers graph database abilities to model many-to-many relationships. The graph relationships are integrated into Transact-SQL and receive the benefits of using SQL Server as the foundational database management system.|
|OpenLink Virtuoso||8.0 (September 2017)||Open Source Edition is GPLv2, Enterprise Edition is proprietary||C, C++||Hybrid database server handling RDF and other graph data, RDB-SQL data, XML data, filesystem documents-objects, and free text; may be deployed as a local embedded instance (as used in the NEPOMUK Semantic Desktop), a one-instance network server, or a shared-nothing elastic-cluster multiple-instance networked server|
|Oracle Spatial and Graph; part of Oracle Database||188.8.131.52 (2014)||Proprietary||Java, PL/SQL||1) RDF Semantic Graph: comprehensive W3C RDF graph management in Oracle Database with native reasoning and triple-level label security. 2) Network Data Model property graph: for physical/logical networks with persistent storage and a Java API for in-memory graph analytics|
|OrientDB||2.2.24 (July 2017)||Community Edition is Apache 2, Enterprise Edition is commercial||Java||Second generation distributed graph database with the flexibility of documents in one product (i.e., it is both a graph database and a document NoSQL database at the same time); it has an open source commercial friendly (Apache 2) license; and is a highly scalable with full ACID support; it has a multi-master replication and sharding; supports schema-less, -full, and -mixed modes; has a strong security profiling system based on user and roles; supports a query language that is so similar to SQL which is friendly to those coming from a SQL and relational database background decreasing the learning curve needed. It has HTTP REST + JSON API.|
|Sparksee||5.2.0 (2015)||Proprietary, commercial, freeware for evaluation, research, development||C++||High-performance scalable database management system from Sparsity Technologies; main trait is its query performance for retrieving & exploring large networks; has bindings for Java, C++, C#, Python, and Objective-C; version 5 is the first graph mobile database|
|Sqrrl Enterprise||2.0 (February 2015)||Proprietary||Java||Distributed, real-time graph database featuring cell-level security and mass-scalability|
|Teradata Aster||7 (2016)||Proprietary||Java, SQL, Python, C++, R||High performance, multi-purpose, highly scalable, and extensible MPP database incorporating patented engines supporting native SQL, MapReduce and Graph data storage and manipulation; provides an extensive set of analytic function libraries and data visualization abilities|
|TigerGraph||2.0 (2018)||Developer Edition is free for evaluation and education, Enterprise Edition is proprietary||C++||Native Massively parallel(MPP) real-time graph database, supporting high expressive GSQL, RESTful API, and visualization GraphStudio SDK. It provides industry first multiple-graph security control and collaboration environment.|
APIs and graph query-programming languages
- AQL (ArangoDB Query Language) - an SQL-like query language used in ArangoDB for both documents and graphs
- Cypher Query Language (Cypher) – a graph query declarative language for Neo4j that enables ad hoc and programmatic (SQL-like) access to the graph. Spec opened up as openCypher project.
- GraphQL – Facebook query language for any backend service
- GraphQL+ - DGraph's version of GraphQL
- Gremlin – a graph programming language that works over various graph database systems; part of Apache TinkerPop open-source project
- GSQL – TigerGraph declarative language for graph analytics.
- SPARQL – a query language for databases, can retrieve and manipulate data stored in Resource Description Framework format
- V1 – a visual query language for property graphs
- Structured storage
- Object database
- Graph transformation
- RDF Database
- Hierarchical database model
- Text graph
- Nikolaos G. Bourbakis. Artificial Intelligence and Automation. World Scientific. p. 381. Retrieved 2018-04-20.
- Angles, Renzo; Gutierrez, Claudio (1 Feb 2008). "Survey of graph database models" (PDF). ACM Computing Surveys. Association for Computing Machinery. 40 (1). doi:10.1145/1322432.1322433. Retrieved 28 May 2016.
network models [...] lack a good abstraction level: it is difficult to separate the db-model from the actual implementation
- Silberschatz, Avi (28 January 2010). Database System Concepts, Sixth Edition (PDF). McGraw-Hill. p. D-29. ISBN 0-07-352332-1.
- "From Relational to Graph Databases". Neo4j.
- "Examples where Graph databases shine: Neo4j edition", ZeroTurnaround
- Silberschatz, Avi (28 January 2010). Database System Concepts, Sixth Edition (PDF). McGraw-Hill. p. E-20. ISBN 0-07-352332-1.
- Parker, Lorraine. "IMS Notes". vcu.edu. Retrieved 31 May 2016.
- Kuper, Gabriel M (1985). The Logical Data Model: A New Approach to Database Logic (PDF) (Ph.D.). Docket STAN-CS-85-1069. Retrieved 31 May 2016.
- "SAP Announces New Capabilities in the Cloud with HANA". 2014-10-22. Retrieved 2016-07-07.
- "Graph DBMS Performance Comparison AgensGraph vs. Neo4j". www.businesswire.com. Retrieved 2018-01-15.
- "In-Memory Massively Parallel Distributed Graph Database Purpose-built for Analytics". www.Cambridgesemantics.com. Retrieved 2018-02-20.
- Rueter, John (February 15, 2018). "Cambridge Semantics Announces AnzoGraph Graph-Based Analytics Support for Amazon Neptune and Graph Databases". Businesswire. Retrieved February 20, 2018.
- Zane, Barry (November 2, 2016). "Semantic Graph Databases: A worthy successor to relational databases". www.dbta.com. Retrieved February 20, 2018.
- "Cambridge Semantics Announces AnzoGraph Support for Amazon Neptune and Graph Databases". Database Trends and Applications. 2018-02-15. Retrieved 2018-03-08.
- Fowler, Adam (February 24, 2015). NoSQL for Dummies. John Wiley & Sons. pp. 298–. ISBN 978-1-118-90574-6.
- Vaughan, Jack (January 25, 2016). "Beyond gaming, GPU technology takes on graphs, machine learning". TechTarget. Retrieved May 9, 2017.
- Yegulalp, Serdar (September 26, 2016). "Faster with GPUs: 5 turbocharged databases". InfoWorld. Retrieved May 9, 2017.
- "Google Releases Cayley Open-Source Graph Database". eWeek. November 13, 2014. Retrieved May 9, 2017.
- "Ex-Googler startup DGraph Labs raises US$1.1 million in seed funding round to build industry's first open source, native and distributed graph database". Globenewswire. May 17, 2016. Retrieved July 31, 2017.
- Bailey, Michael (May 18, 2016). "Cannon-Brookes, Blackbird, Bain back new migrant's graph start-up". afr.com. The Australian Financial Review. Retrieved July 31, 2017.
- Woodie, Alex (June 21, 2016). "Beyond Titan: The Evolution of DataStax's New Graph Database". Datanami. Retrieved May 9, 2017.
- Longbottom, Clive (May 1, 2016). "Graph databases: What are the benefits for CIOs?". Computer Weekly. Retrieved May 9, 2017.
- "gStore Graph Database Engine".
- Zou, Lei; Özsu, M. Tamer; Chen, Lei; Shen, Xuchuan; Huang, Ruizhe; Zhao, Dongyan (August 2014). "gStore: a graph-based SPARQL query engine".
- "The Linux Foundation Welcomes JanusGraph". The Linux Foundation. January 12, 2017. Retrieved February 10, 2018.
- Brukman, Misha (January 12, 2017). "JanusGraph connects the past and future of Titan". Google. Retrieved February 10, 2018.
- He, Jing Chen (January 16, 2017). "JanusGraph – A Graph DB that carries forward the legacy of Titan". IBM. Retrieved May 9, 2017.
- Woodie, Alex (January 13, 2017). "JanusGraph Picks Up Where TitanDB Left Off". Datanami. Retrieved May 9, 2017.
- "What's New in SQL Server 2017". Microsoft Docs. April 19, 2017. Retrieved May 9, 2017.
- "Release Notes: Neo4j 3.1.1". Neo4j. Retrieved May 9, 2017.
- "Ranking of Graph DBMS". DB-Engines. Retrieved May 9, 2017.
- "Clustering Deployment Architecture Diagrams for Virtuoso". Virtuoso Open-Source Wiki. OpenLink Software. Retrieved May 9, 2017.
- Rudolf, Michael; Paradies, Marcus; Bornhövd, Christof; Lehner, Wolfgang. The Graph Story of the SAP HANA Database (PDF). Lecture Notes in Informatics.
- "Sparksee high-performance graph database". Sparsity-technologies. Retrieved May 9, 2017.
- Vanian, Jonathan (18 February 2015). "NSA-linked Sqrrl eyes cyber security and lands $7M in funding". Gigaom. Retrieved May 9, 2017.
- Woodie, Alex (October 23, 2015). "The Art of Analytics, Or What the Green-Haired People Can Teach Us". Datanami. Retrieved May 9, 2017.
- "TigerGraph 2.0 Helps Enterprises Roar with the Fastest and Most Scalable Graph Analytics". 2018-02-27. Retrieved 2018-02-27.
- Svensson, Johan (5 July 2016). "Guest View: Relational vs. graph databases: Which to use and when?". sdtimes.com. BZ Media. Retrieved 30 August 2016.
- TinkerPop, Apache. "Apache TinkerPop". tinkerpop.apache.org. Retrieved 2016-11-02.
- "GSQL". doc.tigergraph.com/dev/. Retrieved 2017-10-01.
- Kogan, Lior (2017). "V1: A Visual Query Language for Property Graphs". arXiv: .
- "V1: A Visual Query Language for Property Graphs". github.com. Retrieved 2017-11-01.