Terminology

The terminology used for Cypher and Neo4j is drawn from the worlds of database design and graph theory. This section provides cross-linked summaries of common terms.

In some cases, multiple terms (e.g., arc, edge, relationship) may be used for the same or similar concept. An asterisk (*) to the right of a term indicates that the term is commonly used for Neo4j and Cypher.

acyclic

for a graph or subgraph: when there is no way to start at some node n and follow a sequence of adjacent relationships that eventually loops back to n again. The opposite of cyclic.

adjacent

nodes sharing an incident (that is, directly-connected) relationship or relationships sharing an incident node.

aggregating expression

expression that summarizes a set of values, like computing their sum or their maximum.

arc

graph theory: a synonym for a directed relationship.

array

container that holds a number of elements. The element types can be the types supported by the underlying graph storage layer, but all elements must be of the same type.

attribute

Synonym for property.

clause

component of a Cypher query or command; starts with an identifying keyword (for example CREATE). The following clauses currently exist in Cypher: CREATE, CREATE UNIQUE, DELETE, FOREACH, LOAD CSV, MATCH, MERGE, OPTIONAL MATCH, REMOVE, RETURN, SET, START, UNION, and WITH.

co-incident

alternative term for adjacent relationships, which share a common node.

collection

container that holds a number of values. The values can have mixed types.

command

a statement that operates on the database without affecting the data graph or returning content from it.

commit

successful completion of a transaction, ensuring durability of any changes made.

constraint

part of a database schema: defines a contract that the database will never break (for example, uniqueness of a property on all nodes that have a specific label).

cyclic

The opposite of acyclic.

Cypher

a special-purpose programming language for describing queries and operations on a graph database, with accompanying natural language concepts.

DAG

a directed, acyclic graph: there are no cyclic paths and all the relationships are directed.

data graph

graph stored in the database. See also property graph.

data record

a unit of storage containing an arbitrary unordered collection of properties.

degree

of a node: is the number of relationships leaving or entering (if directed) the node; loops are counted twice.

directed relationship

a relationship that has a direction; that is the relationship has a source node and a destination node. The opposite of an undirected relationship. All relationships in a Neo4j graph are directed.

edge

graph theory: a synonym for undirected relationship.

execution plan

parsed and compiled statement that is ready for Neo4j to execute. An execution plan consists of the physical operations that need to be performed in order to achieve the intent of the statement.

execution result

all statements return an execution result. For queries, this can contain an iterator of result rows.

expression

produces values; may be used in projections, as a predicate, or when setting properties on graph elements.

graph
  1. data graph,
  2. property graph,
  3. graph theory: set of vertices and edges.
graph database

a database that uses graph-based structures (for example, nodes, relationships, properties) to represent and store data.

graph element

a node, relationship, or path which is part of a graph.

incident

adjacent relationship attached to a node or a node attached to a relationship.

incoming relationship

pertaining to a directed relationship: from the point of view of a node n, this is any relationship r arriving at n, exemplified by ()-[:r]->(n). The opposite of outgoing.

index

data structure that improves performance of a database by redundantly storing the same information in a way that is faster to read.

intermediate result

set of variables and values (record) passed from one clause to another during query execution. This is internal to the execution of a given query.

label

marks a node as a member of a named subset. A node may be assigned zero or more labels. Labels are written as :label in Cypher (the actual label is prefixed by a colon). Note: graph theory: This differs from mathematical graphs, where a label applies uniquely to a single vertex.

loop

a relationship that connects a node to itself.

neighbor

of node: another node, connected by a common relationship; of relationship: another relationship, connected to a common node.

node*

data record within a data graph; contains an arbitrary collection of properties. Nodes may have zero, one, or more labels and are optionally connected by relationships. Similar to vertex.

null

NULL is a special marker, used to indicate that a data item does not exist in the graph or that the value of an expression is unknown or inapplicable.

operator

there are three categories of operators in Cypher:

  1. Arithmetic, such as +, /, % etc.;
  2. Logical, such as OR, AND, NOT etc.; and
  3. Comparison, such as <, >, = etc.
outgoing relationship

pertaining to a directed relationship: from the point of view of a node n, this is any relationship r leaving n, exemplified by (n)-[:r]->(). The opposite of incoming relationship.

parameter

named value provided when running a statement. Parameters allow Cypher to efficiently re-use execution plans without having to parse and recompile every statement when only a literal value changes.

path*

collection of alternating nodes and relationships that corresponds to a walk in the data graph.

pattern graph

graph used to express the shape (that is, connectivity pattern) of the data being searched for in the data graph. This is what MATCH and WHERE describe in a Cypher query.

predicate

expression that returns TRUE, FALSE or NULL. When used in WHERE, NULL is treated as FALSE.

projection

an operation taking result rows as both input and output data. This may be a subset of the variables provided in the input, a calculation based on variables in the input, or both. The relevant clauses are WITH and RETURN.

property graph

a graph having directed, typed relationships. Each node or relationship may have zero or more associated properties.

property*

named value stored in a node or relationship. Synonym for attribute.

query*

statement that reads or writes data from the database

relationship type

marks a relationship as a member of a named subset. A relationship must be assigned one and only one type. For example, in the Cypher pattern (start)-[:TYPE]->(to), TYPE is the relationship type.

relationship*

data record in a property graph that associates an ordered pair of nodes. Similar to arc and edge.

result row

each query returns an iterator of result rows, which represents the result of executing the query. Each result row is a set of key-value pairs (a record).

rollback

abort of the containing transaction, effectively undoing any changes defined inside the transaction.

schema

persistent database state that describes available indexes and enabled constraints for the data graph.

schema command

statement that updates the schema.

statement

text string containing a Cypher query or command.

transaction

A transaction comprises a unit of work performed against a database. It is treated in a coherent and reliable way, independent of other transactions. A transaction, by definition, must be atomic, consistent, isolated, and durable.

transitive closure

of a graph: is a graph which contains a relationship from node x to node y whenever there is a directed path from x to y; For example, if there is a relationship from a to b, and another from b to c, then the transitive closure includes a relationship from a to c.

type

types classify values. Each value in Cypher has a concrete type. Supported types are:

  • string,
  • boolean,
  • the number types (double, integer, long),
  • the map types (plain maps, nodes, and relationships),
  • and collections of any concrete type.

The type hierarchy supports several other types (for example, any, scalar, derived map, collection). These are used to classify values and collections of values having different concrete types.

undirected relationship

a relationship that doesn’t have a direction. The opposite of directed relationship.

variable

variables are named bindings to values (for example, collections, scalars) in a statement. For example, in MATCH (n) RETURN n, n is a variable.

vertex

graph theory: the fundamental unit used to form a mathematical graph (plural: vertices). See node.