Database Reference
In-Depth Information
Graph Databases
In its simplest form, a graph database is a set of vertices and edges. Another way to picture graph databases is to
view the data as an arbitrary set of objects connected by one or more kinds of relationships. This section defines and
expands on the most essential components of a graph database—specifically, how they occur within and apply to the
graph database, Neo4j.
Nodes and Relationships
When discussing graph databases, vertices are more commonly referred to as nodes and edges are more commonly
referred to as relationships (Figure 1-4 ). While these two pairs of terms may be used interchangeably, this topic follows
the more common usage.
Figure 1-4. Two nodes connected by a relationship
A node can be thought of as an object with any number of properties. Unlike the keys that connect rows within a
relational database, relationships within a graph database can also have properties.
Labels
Starting with the 2.0 version of Neo4j, the concept of labels was introduced as a way to group nodes. As the example
in Figure 1-5 demonstrates, you can define a node as “Person” and then provide additional values for each property
of the node as necessary. By grouping nodes in this way, we can query the graph to show common subsets of what are
essentially node types. Labeling of nodes also offers a way to enforce modeling constraints when necessary, as well as
to increase the speed at which data can be accessed through improved indexing.
Figure 1-5. Labels provide a way for nodes to be grouped
 
Search WWH ::




Custom Search