Node Properties

This section explains the currently supported node properties.

The Neo4j Graph Data Science Library is capable of augmenting nodes with additional properties. These properties can be loaded from the database when the graph projection is created. Many algorithms can also persist their result as one or more node properties when they are run using the mutate mode.

1. Supported types

The Neo4j Graph Data Science library does not support all property types that are supported by the Neo4j database. Every supported type also defines a fallback value, which is used to indicate that the value of this property is not set.

The following table lists the supported property types, as well as, their corresponding fallback values.

  • Long - Long.MIN_VALUE

  • Double - NaN

  • Long Array - null

  • Float Array - null

  • Double Array - null

2. Defining the type of a node property

When creating a graph projection that specifies a set of node properties, the type of these properties is automatically determined using the first property value that is read by the loader for any specified property. All integral numerical types are interpreted as Long values, all floating point values are interpreted as Double values. Array values are explicitly defined by the type of the values that the array contains, i.e. a conversion of, for example, an Integer Array into a Long Array is not supported. Arrays with mixed content types are not supported.

3. Automatic type conversion

Most algorithms that are capable of using node properties require a specific property type. In cases of a mismatch between the type of the provided property and the required type, the library will try to convert the property value into the required type. This automatic conversion only happens when the following conditions are satisfied:

  • Neither the given, nor the expected type are an Array type.

  • The conversion is loss-less

    • Long to Double: The Long values does not exceed the supported range of the Double type.

    • Double to Long: The Double value does not have any decimal places.

The algorithm computation will fail if any of these conditions are not satisfied for any node property value.

The automatic conversion is computationally more expensive and should therefore be avoided in performance critical applications.