In computing, a graph database 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. This contrasts with conventional relational databases, where links between data are ad hoc and based on the data itself, and related items are gathered by searching for this data within the store. Graph databases are designed to allow simple and rapid retrieval of complex hierarchical structures, whereas a relational database would use a complex query to achieve the same end, generally with far less performance. Graph databases are similar to 1970s network model databases in that both are designed to 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 database products varies. Some, like MariaDB, are based on a relational engine and store the graph data in a table. More common examples generally use a key-value store or document-oriented database for storage, making them inherently NoSQL solutions. These solutions generally offer a performance advantage because the graph is stored in a format similar to a database index, minimizing its size and retrieval time. Most graph databases based on non-relational storage engines also add the concept of tags or properties, which are essentially relationships lacking a pointer to another document. This allows data elements to be categorized for easy retrieval en masse. Examples of NoSQL graph databases include OrientDB, Neo4j and ArangoDB.
Retrieving data from a graph database requires new concepts and generally a new query language. To date, no other single graph query language has risen to prominence in the same fashion as SQL did for relational databases, and there are a wide variety of systems most often tightly tied to a particular product. Some standardization efforts have taken place, leading to systems like Gremlin that work with a variety of graph engines, and the SPARQL system which has seen some multi-vendor adoption.
Graph databases are based on graph theory. Graph databases employ nodes, edges and properties.
The relational model gathers data together using information in the data itself. For instance, one might look for all the "users" who's phone number contains the area code "311". This would be accomplished 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 an index which allows data like this to be stored in a smaller sub-table, containing only the selected data and a unique key (or primary key) of the record it is part of. With an index of phone numbers available, the same search can be performed on the index, gathering the keys, 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 rapid.
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 instance, 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, known as a join, can be computationally expensive. 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 up 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 related entry in the user table, and often that same pointer can be followed in the reverse direction from the email address to the user. In contrast to the join operation in a conventional system, a graph database can quickly retrieve related data without any searches. For instance, 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. This avoids the second search that the join requires, and (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 instance, 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 comparison, a graph database would look for all the users in 311, then follow the back-links through the subscriber relationship to find the 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 comparison, the relational version would be multiple O(log(n)) lookups plus additional time to join all the data.
The relative advantage of graph retrieval grows with the complexity of the query. For instance, 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, collecting more and more data into temporary tables, doing another search on submarine, finding all the actors in those movies, and the comparing the results. In comparison, 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 accomplished in a single 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 as well. For instance, 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 additional 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 additional 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 instance, 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 require expensive join operations. As they depend less on a rigid schema, they are more suitable to manage ad hoc and changing data with evolving schemas. Conversely, relational databases are typically faster at performing the same operation on large numbers of data elements.
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).
The following is a list of graph databases:
|AllegroGraph||5.1 (May 2015)||Proprietary. Clients: Eclipse Public License v1.||C#, C, Common Lisp, Java, Python||An RDF and graph database.|
|Blazegraph||1.5.3 (September 2015)||GPLv2, evaluation license, or commercial license.||Java||A RDF/graph database capable of clustered deployment. Blazegraph supports high availability (HA) mode, embedded mode, single server mode. As of version 1.3.1, it supports the Blueprints API and Reification Done Right (RDR). Prior to version 1.5.0; formerly named Bigdata.|
|Bitsy||1.5.0||AGPL, Enterprise license (unlimited use, annual/perpetual)||Java||A small, embeddable, durable in-memory graph database|
|BrightstarDB||1.10.1 (May 2015)||MIT License ||C#||An embeddable NoSQL database for the .NET Framework with code-first data model generation.|
|Cayley||0.4.1 (April 2015)||Apache 2||Go||An open-source graph inspired by the graph database behind Freebase and Google's Knowledge Graph.|
|DEX/Sparksee||5.2.0 (2015)||Evaluation, research or development use is free; commercial use is not free||C++||A high-performance and scalable graph database management system from Sparsity Technologies. Its main characteristics is its query performance for the retrieval & exploration of large networks. Sparksee offers bindings for Java, C++, C#, Python and Objective-C. Sparksee 5 mobile is the first graph database for mobile devices.|
|Filament||BSD||Java||A graph persistence framework and associated toolkits based on a navigational query style.|
|GraphBase||1.0.03a||Proprietary||Java||A customizable, distributed, small-footprint graph store with a rich tool set from FactNexus.|
|graphd||Proprietary||The proprietary back-end of Freebase.|
|Graph Engine||1.0||Office Store Standard Application License (Free)||C++, C#||A distributed, in-memory, large graph processing engine.|
|Grapholytic||0.1||Proprietary||A distributed GraphDB from MIOsoft.|
|Horton||Proprietary||C#||A graph database from Microsoft Research Extreme Computing Group (XCG) based on the cloud programming infrastructure Orleans.|
|HyperGraphDB||1.2 (2012)||LGPL||Java||A graph database supporting generalized hypergraphs where edges can point to other edges.|
|IBM System G Native Store||v1.0 (July 2014)||Proprietary||C, C++, Java||A high performance graph store using natively implemented graph data structures and primitives for achieving superior efficiency. IBM System G Native Store can handle various simple graphs, property graphs, and RDF graphs, in terms of storage, analytics, and visualization. Native Store is accessible from most programming languages by providing APIs in C++, Java (Tinkerpop/Blueprints), and Python. Its gShell graph command collection and the Native Store REST APIs provide language-free interfaces.|
|InfiniteGraph||3.0 (January 2013)||Proprietary||Java||A distributed and cloud-enabled commercial product with flexible licensing.|
|InfoGrid||2.9.5 (2011)||AGPLv3, free for small entities||Java||A graph database with web front end and configurable storage engines (MySQL, PostgreSQL, Files, Hadoop).|
|jCoreDB Graph||An extensible database engine with a graph database subproject.|
|k-infinity||4.0 (2015)||Proprietary, free tryout version and demo scenarios||A semantic graph database which is characterised by its graphical user interface and requires no knowledge of any query language. API is open and based on REST and JSON. Thus it can be easily embedded in existing architectures.|
|GPLv3 Community Edition. Commercial & AGPLv3 options for enterprise and advanced editions||Java,||A highly scalable open source graph database that supports ACID, has high-availability clustering for enterprise deployments, and comes with a web-based administration tool that includes full transaction support and visual node-link graph explorer. Neo4j is accessible from most programming languages using its built-in REST web API interface, as well as a proprietary Bolt protocol with official drivers. Neo4j is the most popular graph database in use as of March 2016.|
|OpenCog||AGPL||C++, Scheme, Python||Includes a satisfiability modulo theories solver and a unified rule engine for performing both crisp (boolean) logic and probabilistic reasoning. Backed onto Postgres.|
|Ontotext GraphDB||7||GraphDB Free is free.
GraphDB Standard and GraphDB Enterprise are commercially licensed.
|Java||A graph database engine, based fully on Semantic Web standards from W3C: RDF, RDFS, OWL, SPARQL. GraphDB Free is a database engine for small projects. GraphDB Standard is robust standalone database engine. GraphDB Enterprise is a clustered version which offers horizontal scalability and failover support and other enterprise features.|
|Orly||(March 2014)||Apache 2||C++||A highly scalable open source graph database; accessible from most programming languages via its built-in REST web API interface.|
|OpenLink Virtuoso||7.1 (March 2014)||GPLv2 for Open Source Edition. Proprietary for Enterprise Edition.||C, C++||A 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 single-instance network server, or a shared-nothing elastic-cluster multiple-instance networked server.|
|Oracle Spatial and Graph||11.2 (2012)||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.|
|Oracle NoSQL Database||2.0.39 (2013)||Proprietary||Java||RDF Graph for Oracle NoSQL Database is a feature of Enterprise Edition providing W3C RDF graph capabilities in NoSQL Database.|
|OrientDB||2.2.0 (May 2016)||Community Edition is Apache 2, Enterprise Edition is commercial||Java||OrientDB is an open source 2nd 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. It is a highly scalable graph database with full ACID support. It has a multi-master replication and sharding. Supports schema-less, schema-full and schema-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.|
|OQGRAPH||GPLv2||A graph computing engine for MySQL, MariaDB and Drizzle.|
|Profium Sense||6.0||Proprietary||Java||Profium Sense is a contextual content management platform with a built-in triple store. Profium's own reasoning engine supports OWL 2 RL and RDFS and is optimized to manage continuous information streams that require continuous inferencing on-the-fly. Profium architecture is based on an in-memory database with ACID transaction support and supports distributed high-availability deployment.|
|R2DF||R2DF framework for ranked path queries over weighted RDF graphs.|
|ROIS||Freeware||Modula-2||A programmable knowledge server that supports inheritance and transitivity. Used in OpenGALEN as a terminology server.|
|Sqrrl Enterprise||v1.5.1 (August 2014)||Proprietary||Java||Distributed, real-time graph database featuring cell-level security and mass-scalability.|
|Stardog||v3.1.5 (July 2015)||Proprietary||Java||Fast, scalable, pure Java semantic graph database.|
|Teradata Aster||v6 (2013)||Proprietary||Java, SQL, Python, C++, R||A high performance, multi-purpose, highly scalable and extensible MPP database incorporating patented engines supporting native SQL, MapReduce and Graph data storage and manipulation. An extensive set of analytical function libraries and data visualization capabilities are also provided.|
|Titan||1.0 (September 2015)||Apache 2||Java||A distributed, real-time, scalable transactional graph database developed by Aurelius.|
|TripleBit||C, C++||A centralized RDF store.|
|VelocityGraph||Open source with proprietary back-end||C#||High performance, scalable & flexible graph database build with VelocityDB object database.|
|VertexDB||Revised BSD||C||A graph database server that supports automatic garbage collection.|
|VivaceGraph||3.0 (December 2014)||MIT License||Common Lisp||Pure Common Lisp graph database.|
|Weaver||0.1 (December 2014)||BSD licenses||C, Python||A fast, scalable, ACID transactional graph database with replication and migration.|
|WhiteDB||0.7.0 (October 2013)||GPLv3 and a free commercial licence||C||A graph/N-tuples shared memory database library.|
|OhmDB||1.0.0 (August 2014)||Apache 2||Java||RDBMS + NoSQL Database for Java.|
The table below compares the features of the above graph databases.
|Name||Graph Model||API||Query Methods||Visualizer||Consistency||Backend||Scalability|
|Blazegraph||RDF||Java, Sesame, Blueprints, Gremlin, SPARQL, REST||SPARQL, Gremlin||Blazegraph Workbench UI||MVCC/ACID||Native Java||Embedded, Client/Server, High Availability (HA)|
|Bitsy||Property graph||Blueprints||Gremlin, Pixy||ACID with optimistic concurrency control||Human-readable JSON-encoded text files with checksums and markers for recovery|
|DEX/Sparksee||Labeled and directed attributed multigraph||Java, C++, .NET, Python||Native Java, C#, Python and C++ APIs, Blueprints, Gremlin||Exporting functionality to visualization formats||Consistency, durability and partial isolation and atomicity||Native graph. light and independent data structures with a small memory footprint for storage||Master-slave replication|
|GraphBase Enterprise(1) GraphBase Agility(2)||(1) mixed, (2) Framework-managed Simple Graph||Java||Bounds Language, embedded Java||GraphPad, BoundsPad, Navigator||ACID, graph-based transactions||proprietary native||(1) shared nothing distributed, (2) simple replication, 100+ billion arcs per server|
|Graph Engine||Property graph||C#, REST||LINQ, TQL, LIKQ||Atomicity||Native graph store and processing engine||Graphs with billions of nodes, Microsoft Azure Platform|
|Horton||Attributed multigraph||Horton Query Language (Regular Language Expression + SQL)||C#, .Net Framework, asynchronous communication protocols|
|HyperGraphDB||Object-oriented multi-relational labeled hypergraph||Custom,Java||MVCC/STM|
|IBM System G Native Store||Property graph, RDF*||C++, Java, Python||Native Store gShell, Gremlin, SPARQL||Built-in Visualizer||ACID||Native Graph Storage||Both scale-up (using multithreading) and scale-out (using IBM PAMI)|
|InfiniteGraph||Labeled and directed multi-property graph||Java, Blueprints (read only)||Java (with parallel, distributed queries), Gremlin (read only)||Graph browser for developers. Plugins to allow use of external libraries||ACID; and a parallel, loosely synchronized batch loader||Objectivity/DB on standard filesystems||Distributed & sharded. Objectivity/DB was first DBMS to store a petabyte of objects|
|InfoGrid||Dynamically typed, object-oriented graph, multigraphs, semantic models|
|Ontotext GraphDB||RDF Triplestore||Java: Sesame, Jena REST APIs: SPARQL 1.1 Protocol (end-point), SPARQL 1.1 Graph Store HTTP Protocol, Linked Data Platform, SPARQL results in JSON, JSON-LD and all RDF syntaxes||SPARQL 1.1 (full support), Geo-spatial extension of SPARQL, FTS extensions: Lucene, SOLR, Elasticsearch queries, through GraphDB Connectors||GraphDB Workbench: Explore, SPARQL queries, repository management, cluster management, RelFinder.)||Persistent, synchronous, asynchronous||Native graph storage||Master-slave replication, high-availability clustering|
|OpenLink Virtuoso||RDF graph: Triple & Quad (named graphs); expandable column store||SPARQL, XMLA, ODBC, JDBC, ADO.NET, OLE DB, Jena, Sesame, Virtuoso PL/SQL, Java, Python, Perl, PHP, HTTP, etc.||SPARQL 1.1; SPARQL web service endpoint; SQL; others||Pivot Viewer (Silverlight or HTML5); OpenLink Data Explorer; SPARQL-compliant tools; Apache Jena-based tools; XML & JSON-based tools; SQL based tools||ACID||Internal column-store or row-store (depending on licensure), hybrid RDF/SQL/RDB engine||Infinite via Commercial Edition's Cluster Module elastic cluster functionality; simple master-slave clustering of single-server instances also an option.|
|Oracle Spatial and Graph||RDF graph: Triple & Quad (named graphs); Network Data Model property graph||Java; Apache Jena; PL/SQL||SPARQL 1.1; SPARQL web service end point; SQL||SPARQL-compliant tools; Apache Jena-based tools; XML & JSON-based tools; SQL based tools||ACID||Efficient, compressed, partitioned graph storage; Native persisted in-database inferencing; SPARQL 1.1 & SQL integration; triple-level label security; semantic indexing of documents||Parallel load, query, inference; query controls; scales from PC to Oracle Exadata; supports Oracle Real Application Clusters and Oracle Database 8 exabytes|
|Oracle NoSQL Database||RDF graph: Triple default graph, Triple & Quad named graphs||Java (Apache Jena)||SPARQL 1.1; SPARQL web service end point||SPARQL-compliant tools; Apache Jena-based tools; XML & JSON-based tools||ACID; configurable consistency & durability policies||Key/value store; W3C SPARQL 1.1 & update; in-memory RDFS/OWL inferencing||Parallel load-query; Query controls for: parallel execution, timeout, query optimization hints|
|OQGRAPH||Property graph||SQL||ACID||MySQL, MariaDB|
|Sqrrl Enterprise||Property graph||Thrift, Blueprint||Own SQL-like query language and Java API||Integrates with 3rd party tools||Fully Consistent and ACID (transactions limited to a single graph node)||Apache Accumulo||Distributed cluster with tens of trillions of edges|
|Stardog||RDF||Java, Sesame, Jena, SNARL, HTTP/REST, Python, Ruby, Node.js, C#, Clojure, Spring||SPARQL 1.1||Stardog Web, Pelorus||ACID||Native Graph Storage||50 billion RDF triples on $10,000 server|
|Titan||Property graph||Java, Blueprints, REST, RexPro binary protocol, Python, Clojure (any language)||Gremlin, SPARQL||Integrates with 3rd party tools||ACID or Eventually Consistent||Apache Cassandra, Apache HBase, MapR M7 Tables, Berkeley DB, Persistit, Hazelcast||Distributed cluster (120 billion+ edges) or single server|
|TripleBit||Labeled direct graph||C, C++||SPARQL||ACID or Eventually Consistent]||Native graph store and processing engine||billion triples|
|Weaver||Property graph||C, Python||Node programs||ACID||HyperDex||Automatic replication and migration|
network models [...] lack a good abstraction level: it is difficult to separate the db-model from the actual implementation