Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

Vector types

The vector type is a data type used to describe vector data, which is defined by a fixed number of dimensions and a specific data type of the coordinates.

Syntax

vector
VECTOR < dimension , coordinate_type >

vector ::=
    'VECTOR' '<' dimension ',' coordinate_type '>'

Each vector type is declared with the keyword VECTOR followed by the number of dimensions and the data type of the coordinates. The number of dimensions must be within the range of 1 to 2,147,483,647. As for the data type of the coordinates, only FLOAT is supported currently.

Declaration example

'''
CREATE GRAPH TYPE IF NOT EXISTS person AS  
    { NODE Person 
        ( { 
            id INT64 PRIMARY KEY,  
            is_adult BOOL DEFAULT TRUE,  
            slogan VECTOR<3, FLOAT> DEFAULT NULL, 
            selfintro VECTOR<10, FLOAT> NULL 
        } ) 
    }
'''

Note

  1. Only the NULL value can be assigned as the default value of a VECTOR property.
  2. VECTOR properties CANNOT be used to form the primary key of a node type or the multi-edge key of an edge type. For more information, see primary_key_list and multi_edge_key_list.

Supported arithmetic operations

The following table lists the arithmetic operations that can be performed on vector type values. For detailed example, see Arithmetic operations for vectors.

Operand 1 Operator Operand 2 Result
vector + or - number or vector with the same dimension vector
vector * or / number vector

More information