Node Embedding Algorithms

class graphdatascience.procedure_surface.api.node_embedding.EmbeddingCreateResult

Bases: MutateResult, NodeResult

class graphdatascience.procedure_surface.api.node_embedding.EmbeddingEndpoints

Bases:

abstractmethod create(G: Graph, *, graph_encoder: str | FastRPConfig | None = None, embedding_dimension: int | None = None, random_seed: int | None = None, mutate_property: str = 'embedding', job_id: str | None = None, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], input_properties: list[str] = []) → EmbeddingCreateResult
Parameters:
  • G (Graph) – Graph object to use

  • graph_encoder (str | FastRPConfig | None) – Encoder used to produce node embeddings: either the name of a previously trained encoder model, or an inline configuration for a non-trainable encoder (e.g. FastRP or Identity).

  • embedding_dimension (int | None) – Dimension of the node embeddings.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • mutate_property (str) – Name of the node property to store the results in.

  • job_id (str | None) – Identifier for the computation.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • input_properties (list[str]) – Names of the node properties to use as input features

Return type:

EmbeddingCreateResult

abstractmethod train(G: Graph, *, graph_encoder: GraphSAGEConfig | None = None, decoder: MLPClassifierConfig | None = None, embedding_dimension: int | None = None, model_name: str, target_label: str, target_property: str, num_epochs: int | None = None, batch_size: int | None = None, random_seed: int | None = None, job_id: str | None = None, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], input_properties: list[str]) → EmbeddingTrainResult

embeddings.train is a preview feature and may change or be removed in future releases.

Parameters:
  • G (Graph) – Graph object to use

  • graph_encoder (GraphSAGEConfig | None) – Configuration for the graph encoder to train (e.g. FastRP, GraphSAGE, or Identity).

  • decoder (MLPClassifierConfig | None) – Configuration for the decoder to train on top of the graph encoder’s embeddings.

  • embedding_dimension (int | None) – Dimension of the node embeddings.

  • model_name (str) – Name to save the trained graph encoder + decoder model under.

  • target_label (str) – Node label to train on.

  • target_property (str) – Node property to train on.

  • num_epochs (int | None) – Maximum number of training epochs.

  • batch_size (int | None) – Number of examples per training batch.

  • num_trials – Number of hyperparameter tuning trials to run.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • job_id (str | None) – Identifier for the computation.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • input_properties (list[str]) – Names of the node properties to use as input features

Return type:

EmbeddingTrainResult

class graphdatascience.procedure_surface.api.node_embedding.EmbeddingTrainResult

Bases: StatsResult

class graphdatascience.procedure_surface.api.node_embedding.FastPathEndpoints

Bases:

Endpoints for the FastPath node embedding algorithm.

FastPath is a lightweight path-embedding algorithm for temporal graphs: it computes embeddings for base nodes from their associated event sequences, aggregating event vectors by event type and elapsed time. It is only available on the Arrow (Aura Graph Analytics) surface.

See https://neo4j.com/docs/snowflake-graph-analytics/current/algorithms/fastpath/

abstractmethod mutate(G: Graph, base_node_label: str, event_node_label: str, mutate_property: str, embedding_dimension: int, lookback_horizon: int, num_time_anchors: int | None = None, time_anchor_interval: float | None = None, *, event_node_categorical_properties: list[str] = [], relationship_types: list[str] = ['*'], context_node_label: str | None = None, decay_rate: float = 1.0, event_node_feature_vector_property: str | None = None, first_relationship_type: str | None = None, event_node_ignored_category: int = -1, next_relationship_type: str | None = None, observation_time: float | None = None, base_node_observation_time_property: str | None = None, random_seed: Any | None = None, smoothing_rate: float = 0.0, smoothing_window: int = 0, event_node_time_property: str | None = None, job_id: str | None = None) → FastPathMutateResult

Executes the FastPath algorithm and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • base_node_label (str) – Node label identifying the nodes to compute embeddings for.

  • event_node_label (str) – Node label marking the event nodes linked to base nodes.

  • mutate_property (str) – Name of the node property to store the results in.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • lookback_horizon (int) – Maximum age of events (relative to the observation time) that are processed.

  • num_time_anchors (int | None) – Number of grid points used to discretize elapsed time. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • time_anchor_interval (float | None) – Time interval between anchor embeddings in the grid. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • event_node_categorical_properties (list[str]) – Event node properties holding categorical values.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • context_node_label (str | None) – Optional node label for context nodes describing events.

  • decay_rate (float) – Controls how quickly the influence of older events decays.

  • event_node_feature_vector_property (str | None) – Name of the vector property on event nodes holding numerical features.

  • first_relationship_type (str | None) – Relationship type connecting base nodes to the first event in a chain.

  • event_node_ignored_category (int) – Event category value treated as missing/ignored.

  • next_relationship_type (str | None) – Relationship type ordering sequential events in a chain.

  • observation_time (float | None) – Single fixed timestamp the embeddings are produced for.

  • base_node_observation_time_property (str | None) – Base node property giving a per-node output timestamp.

  • random_seed (Any | None) – Seed for reproducible random vector generation.

  • smoothing_rate (float) – Controls how event embedding similarity decays with time distance.

  • smoothing_window (int) – Window size for aggregating embeddings across nearby grid times.

  • event_node_time_property (str | None) – Numeric event node property holding the event timestamp.

  • job_id (str | None) – Identifier for the computation.

Returns:

Algorithm metrics and statistics

Return type:

FastPathMutateResult

abstractmethod stream(G: Graph, base_node_label: str, event_node_label: str, embedding_dimension: int, lookback_horizon: int, num_time_anchors: int | None = None, time_anchor_interval: float | None = None, *, event_node_categorical_properties: list[str] = [], relationship_types: list[str] = ['*'], context_node_label: str | None = None, decay_rate: float = 1.0, event_node_feature_vector_property: str | None = None, first_relationship_type: str | None = None, event_node_ignored_category: int = -1, next_relationship_type: str | None = None, observation_time: float | None = None, base_node_observation_time_property: str | None = None, random_seed: Any | None = None, smoothing_rate: float = 0.0, smoothing_window: int = 0, event_node_time_property: str | None = None, job_id: str | None = None) → DataFrame

Executes the FastPath algorithm and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • base_node_label (str) – Node label identifying the nodes to compute embeddings for.

  • event_node_label (str) – Node label marking the event nodes linked to base nodes.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • lookback_horizon (int) – Maximum age of events (relative to the observation time) that are processed.

  • num_time_anchors (int | None) – Number of grid points used to discretize elapsed time. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • time_anchor_interval (float | None) – Time interval between anchor embeddings in the grid. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • event_node_categorical_properties (list[str]) – Event node properties holding categorical values.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • context_node_label (str | None) – Optional node label for context nodes describing events.

  • decay_rate (float) – Controls how quickly the influence of older events decays.

  • event_node_feature_vector_property (str | None) – Name of the vector property on event nodes holding numerical features.

  • first_relationship_type (str | None) – Relationship type connecting base nodes to the first event in a chain.

  • event_node_ignored_category (int) – Event category value treated as missing/ignored.

  • next_relationship_type (str | None) – Relationship type ordering sequential events in a chain.

  • observation_time (float | None) – Single fixed timestamp the embeddings are produced for.

  • base_node_observation_time_property (str | None) – Base node property giving a per-node output timestamp.

  • random_seed (Any | None) – Seed for reproducible random vector generation.

  • smoothing_rate (float) – Controls how event embedding similarity decays with time distance.

  • smoothing_window (int) – Window size for aggregating embeddings across nearby grid times.

  • event_node_time_property (str | None) – Numeric event node property holding the event timestamp.

  • job_id (str | None) – Identifier for the computation.

Returns:

DataFrame with node IDs and their FastPath embeddings

Return type:

pandas.DataFrame

abstractmethod write(G: Graph, base_node_label: str, event_node_label: str, write_property: str, embedding_dimension: int, lookback_horizon: int, num_time_anchors: int | None = None, time_anchor_interval: float | None = None, *, event_node_categorical_properties: list[str] = [], relationship_types: list[str] = ['*'], context_node_label: str | None = None, decay_rate: float = 1.0, event_node_feature_vector_property: str | None = None, first_relationship_type: str | None = None, event_node_ignored_category: int = -1, next_relationship_type: str | None = None, observation_time: float | None = None, base_node_observation_time_property: str | None = None, random_seed: Any | None = None, smoothing_rate: float = 0.0, smoothing_window: int = 0, event_node_time_property: str | None = None, write_concurrency: int | None = None, job_id: str | None = None) → FastPathWriteResult

Executes the FastPath algorithm and writes the results to Neo4j.

Parameters:
  • G (Graph) – Graph object to use

  • base_node_label (str) – Node label identifying the nodes to compute embeddings for.

  • event_node_label (str) – Node label marking the event nodes linked to base nodes.

  • write_property (str) – Name of the node property to store the results in.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • lookback_horizon (int) – Maximum age of events (relative to the observation time) that are processed.

  • num_time_anchors (int | None) – Number of grid points used to discretize elapsed time. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • time_anchor_interval (float | None) – Time interval between anchor embeddings in the grid. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • event_node_categorical_properties (list[str]) – Event node properties holding categorical values.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • context_node_label (str | None) – Optional node label for context nodes describing events.

  • decay_rate (float) – Controls how quickly the influence of older events decays.

  • event_node_feature_vector_property (str | None) – Name of the vector property on event nodes holding numerical features.

  • first_relationship_type (str | None) – Relationship type connecting base nodes to the first event in a chain.

  • event_node_ignored_category (int) – Event category value treated as missing/ignored.

  • next_relationship_type (str | None) – Relationship type ordering sequential events in a chain.

  • observation_time (float | None) – Single fixed timestamp the embeddings are produced for.

  • base_node_observation_time_property (str | None) – Base node property giving a per-node output timestamp.

  • random_seed (Any | None) – Seed for reproducible random vector generation.

  • smoothing_rate (float) – Controls how event embedding similarity decays with time distance.

  • smoothing_window (int) – Window size for aggregating embeddings across nearby grid times.

  • event_node_time_property (str | None) – Numeric event node property holding the event timestamp.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • job_id (str | None) – Identifier for the computation.

Returns:

Algorithm metrics and statistics

Return type:

FastPathWriteResult

class graphdatascience.procedure_surface.api.node_embedding.FastPathMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_count: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.FastPathSessionEndpoints

Bases: FastPathEndpoints

FastPath endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, base_node_label: str, event_node_label: str, embedding_dimension: int, lookback_horizon: int, num_time_anchors: int | None = None, time_anchor_interval: float | None = None, *, event_node_categorical_properties: list[str] = [], relationship_types: list[str] = ['*'], context_node_label: str | None = None, decay_rate: float = 1.0, event_node_feature_vector_property: str | None = None, first_relationship_type: str | None = None, event_node_ignored_category: int = -1, next_relationship_type: str | None = None, observation_time: float | None = None, base_node_observation_time_property: str | None = None, random_seed: Any | None = None, smoothing_rate: float = 0.0, smoothing_window: int = 0, event_node_time_property: str | None = None, job_id: str | None = None) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • base_node_label (str) – Node label identifying the nodes to compute embeddings for.

  • event_node_label (str) – Node label marking the event nodes linked to base nodes.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • lookback_horizon (int) – Maximum age of events (relative to the observation time) that are processed.

  • num_time_anchors (int | None) – Number of grid points used to discretize elapsed time. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • time_anchor_interval (float | None) – Time interval between anchor embeddings in the grid. Exactly one of num_time_anchors and time_anchor_interval must be specified.

  • event_node_categorical_properties (list[str]) – Event node properties holding categorical values.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • context_node_label (str | None) – Optional node label for context nodes describing events.

  • decay_rate (float) – Controls how quickly the influence of older events decays.

  • event_node_feature_vector_property (str | None) – Name of the vector property on event nodes holding numerical features.

  • first_relationship_type (str | None) – Relationship type connecting base nodes to the first event in a chain.

  • event_node_ignored_category (int) – Event category value treated as missing/ignored.

  • next_relationship_type (str | None) – Relationship type ordering sequential events in a chain.

  • observation_time (float | None) – Single fixed timestamp the embeddings are produced for.

  • base_node_observation_time_property (str | None) – Base node property giving a per-node output timestamp.

  • random_seed (Any | None) – Seed for reproducible random vector generation.

  • smoothing_rate (float) – Controls how event embedding similarity decays with time distance.

  • smoothing_window (int) – Window size for aggregating embeddings across nearby grid times.

  • event_node_time_property (str | None) – Numeric event node property holding the event timestamp.

  • job_id (str | None) – Identifier for the computation.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.FastPathWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_count: int
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.FastRPEndpoints

Bases:

abstractmethod estimate(G: Graph | dict[str, Any], embedding_dimension: int, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None) → EstimationResult

Returns an estimation of the memory consumption for that procedure.

Parameters:
  • G (Graph | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • concurrency (int | None) – Number of concurrent threads to use.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

Returns:

Memory estimation details

Return type:

EstimationResult

abstractmethod mutate(G: Graph, mutate_property: str, embedding_dimension: int, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → FastRPMutateResult

Executes the FastRP algorithm and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • mutate_property (str) – Name of the node property to store the results in.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

FastRPMutateResult

abstractmethod stats(G: Graph, embedding_dimension: int, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None) → FastRPStatsResult

Executes the FastRP algorithm and returns result statistics without writing the result to Neo4j.

Parameters:
  • G (Graph) – Graph object to use

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

Returns:

Algorithm statistics

Return type:

FastRPStatsResult

abstractmethod stream(G: Graph, embedding_dimension: int, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → DataFrame

Executes the FastRP algorithm and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

DataFrame with node IDs and their FastRP embeddings

Return type:

pandas.DataFrame

abstractmethod write(G: Graph, write_property: str, embedding_dimension: int, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False, write_concurrency: int | None = None) → FastRPWriteResult

Executes the FastRP algorithm and writes the results to Neo4j.

Parameters:
  • G (Graph) – Graph object to use

  • write_property (str) – Name of the node property to store the results in.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.Returns

  • -------

  • FastRPWriteResult – Algorithm metrics and statistics

Return type:

FastRPWriteResult

class graphdatascience.procedure_surface.api.node_embedding.FastRPMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_count: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.FastRPSessionEndpoints

Bases: FastRPEndpoints

FastRP endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, embedding_dimension: int, *, iteration_weights: list[float] = [0.0, 1.0, 1.0], normalization_strength: float = 0.0, node_self_influence: float = 0.0, property_ratio: float = 0.0, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • iteration_weights (list[float]) – Weights for each iteration. Controls the influence of each iteration on the final embedding.

  • normalization_strength (float) – The normalization strength parameter controls how much the embedding is normalized

  • node_self_influence (float) – The influence of the node’s own features on its embedding

  • property_ratio (float) – The ratio of node properties to use in the embedding

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.FastRPStatsResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_count: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.FastRPWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_count: int
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageEndpoints

Bases: GraphSagePredictEndpoints

API for the GraphSage algorithm, combining both training and prediction functionalities.

estimate(G: Graph | dict[str, Any], model_name: str, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → EstimationResult

Returns an estimation of the memory consumption for that procedure.

Parameters:
  • G (Graph | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.

  • model_name (str) – Name under which the model will is stored

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The estimated cost of running the algorithm

Return type:

EstimationResult

get(name: str) → GraphSageModel
Parameters:

name (str)

Return type:

GraphSageModel

mutate(G: Graph, model_name: str, mutate_property: str, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → GraphSageMutateResult

Uses a pre-trained GraphSage model to predict embeddings for a graph and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • mutate_property (str) – Name of the node property to store the results in.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageMutateResult

stream(G: Graph, model_name: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → DataFrame

Uses a pre-trained GraphSage model to predict embeddings for a graph and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

DataFrame with node IDs and their embeddings

Return type:

pandas.DataFrame

property train: GraphSageTrainEndpoints

Trains a GraphSage model on the given graph.

Parameters:
  • G – Graph object to use

  • model_name – Name of the trained model.

  • feature_properties – Names of the node properties to use as input features

  • activation_function – The activation function to apply after each layer

  • negative_sample_weight – Weight of negative samples in the loss function

  • embedding_dimension – Output dimensionality of the embeddings

  • tolerance – Minimum change in loss between iterations for early stopping an epoch.

  • learning_rate – Learning rate for the training optimization

  • max_iterations – Maximum number of iterations to run.

  • sample_sizes – Number of neighbors to sample at each layer

  • aggregator – The aggregator function for neighborhood aggregation

  • penalty_l2 – L2 regularization penalty

  • search_depth – Maximum search depth for neighbor sampling

  • epochs – Number of training epochs

  • patience – Iterations without a loss within tolerance from the best found, before stopping early.

  • projected_feature_dimension – Dimension to project input features to before training

  • batch_sampling_ratio – Ratio of nodes to sample for each training batch

  • store_model_to_disk – Whether to persist the model to disk

  • relationship_types – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress – Display progress logging.

  • sudo – Disable the memory guard.

  • concurrency – Number of concurrent threads to use.

  • job_id – Identifier for the computation.

  • batch_size – Number of nodes to process in each batch.

  • relationship_weight_property – Name of the property to be used as weights.

  • random_seed – Seed for random number generation to ensure reproducible results.

Returns:

Trained model

Return type:

GraphSageTrainEndpoints

write(G: Graph, model_name: str, write_property: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, write_concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → GraphSageWriteResult

Uses a pre-trained GraphSage model to predict embeddings for a graph and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • write_property (str) – Name of the node property to store the results in.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_count: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSagePredictEndpoints

Bases:

abstractmethod estimate(G: Graph | dict[str, Any], model_name: str, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → EstimationResult

Returns an estimation of the memory consumption for that procedure.

Parameters:
  • G (Graph | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.

  • model_name (str) – Name under which the model will is stored

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The estimated cost of running the algorithm

Return type:

EstimationResult

abstractmethod mutate(G: Graph, model_name: str, mutate_property: str, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → GraphSageMutateResult

Uses a pre-trained GraphSage model to predict embeddings for a graph and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • mutate_property (str) – Name of the node property to store the results in.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageMutateResult

abstractmethod stream(G: Graph, model_name: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → DataFrame

Uses a pre-trained GraphSage model to predict embeddings for a graph and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

DataFrame with node IDs and their embeddings

Return type:

pandas.DataFrame

abstractmethod write(G: Graph, model_name: str, write_property: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, write_concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → GraphSageWriteResult

Uses a pre-trained GraphSage model to predict embeddings for a graph and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name under which the model will is stored

  • write_property (str) – Name of the node property to store the results in.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedEndpoints

Bases:

Endpoints for the supervised (node classification) GraphSage algorithm.

abstractmethod mutate(G: Graph, model_name: str, feature_properties: list[str], mutate_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageSupervisedMutateResult

Uses a pre-trained supervised (node classification) GraphSage model to predict classes for a graph and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – Name of the node property to store the results in.

  • predicted_probability_property (str | None) – Name of the node property to store the predicted class probabilities in.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageSupervisedMutateResult

abstractmethod stream(G: Graph, model_name: str, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Uses a pre-trained supervised (node classification) GraphSage model to predict classes for a graph and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

DataFrame with node IDs, their predicted classes and predicted class probabilities

Return type:

pandas.DataFrame

abstractmethod train(G: Graph, model_name: str, feature_properties: list[str], *, target_label: str, target_property: str, epochs: int, activation_function: str = 'relu', aggregator: str = 'mean', batch_size: int | None = None, class_weights: bool = False, dropout: float = 0.1, embedding_dimension: int = 256, epochs_per_val: int = 0, layer_normalization: bool = True, learning_rate: float = 0.001, num_neighbors: list[int] = [20, 10], random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], split_ratios: dict[str, float] = {'TEST': 0.2, 'TRAIN': 0.6, 'VALID': 0.2}, job_id: str | None = None, gpu: bool = False) → tuple[GraphSageSupervisedModel, GraphSageSupervisedTrainResult]

Trains a supervised (node classification) GraphSage model on the given graph.

The resulting model can be used for prediction with gds.graph_sage.supervised.stream, .write and .mutate.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the trained model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • target_label (str) – Node label to train on.

  • target_property (str) – Node property to train on.

  • epochs (int) – Maximum number of training epochs.

  • activation_function (str) – The activation function to apply after each layer

  • aggregator (str) – The aggregator function for neighborhood aggregation

  • batch_size (int | None) – Number of nodes to process in each batch.

  • class_weights (bool) – Whether to weight the classes inversely proportional to their frequency

  • dropout (float) – Dropout probability applied during training.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • epochs_per_val (int) – Number of training epochs between validation runs

  • layer_normalization (bool) – Whether to apply layer normalization after each layer

  • learning_rate (float) – Learning rate for the training optimization

  • num_neighbors (list[int]) – Number of neighbors to sample at each layer

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • split_ratios (dict[str, float]) – Ratios for splitting the nodes into training, validation and test sets

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The trained model and training metrics

Return type:

tuple[GraphSageSupervisedModel, GraphSageSupervisedTrainResult]

abstractmethod write(G: Graph, model_name: str, feature_properties: list[str], write_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageSupervisedWriteResult

Uses a pre-trained supervised (node classification) GraphSage model to predict classes for a graph and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – Name of the node property to store the results in.

  • predicted_probability_property (str | None) – Name of the node property to store the predicted class probabilities in.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageSupervisedWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedModel

Bases: Model

Represents a supervised (node classification) GraphSage model in the model catalog. Construct this using gds.graph_sage.supervised.train.

predict_mutate(G: Graph, feature_properties: list[str], mutate_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageSupervisedMutateResult

Predict classes for the given graph and mutate the graph with the results.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – The property to mutate with the predicted classes.

  • predicted_probability_property (str | None) – The property to mutate with the predicted class probabilities.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the mutate operation.

Return type:

GraphSageSupervisedMutateResult

predict_stream(G: Graph, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Predict classes for the given graph and stream the results.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The streaming results as a DataFrame with node IDs, predicted classes and predicted class probabilities.

Return type:

pandas.DataFrame

predict_write(G: Graph, feature_properties: list[str], write_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageSupervisedWriteResult

Predict classes for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – The property to write the predicted classes to.

  • predicted_probability_property (str | None) – The property to write the predicted class probabilities to.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the write operation.

Return type:

GraphSageSupervisedWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedSessionEndpoints

Bases: GraphSageSupervisedEndpoints

Supervised (node classification) GraphSage endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, model_name: str, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedTrainResult

Bases: BaseResult

configuration: dict[str, Any]
pre_processing_millis: int
train_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageSupervisedWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageTrainEndpoints

Bases:

abstractmethod estimate(G: Graph, model_name: str, feature_properties: list[str], *, activation_function: str = 'SIGMOID', negative_sample_weight: int = 20, embedding_dimension: int = 64, tolerance: float = 0.0001, learning_rate: float = 0.1, max_iterations: int = 10, sample_sizes: list[int] | None = None, aggregator: str = 'MEAN', penalty_l2: float = 0.0, search_depth: int = 5, epochs: int = 1, patience: int | None = None, projected_feature_dimension: int | None = None, batch_sampling_ratio: float | None = None, store_model_to_disk: bool = False, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, relationship_weight_property: str | None = None, random_seed: int | None = None) → EstimationResult

Estimates memory requirements and other statistics for training a GraphSage model.

This method provides memory estimation for the GraphSage training algorithm without actually executing the training. It helps determine the computational requirements before running the actual training procedure.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the trained model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • activation_function (str) – The activation function to apply after each layer

  • negative_sample_weight (int) – Weight of negative samples in the loss function

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • tolerance (float) – Minimum change in loss between iterations for early stopping an epoch.

  • learning_rate (float) – Learning rate for the training optimization

  • max_iterations (int) – Maximum number of iterations to run.

  • sample_sizes (list[int] | None) – Number of neighbors to sample at each layer. Defaults to [25, 10] if not specified

  • aggregator (str) – The aggregator function for neighborhood aggregation

  • penalty_l2 (float) – L2 regularization penalty

  • search_depth (int) – Maximum search depth for neighbor sampling

  • epochs (int) – Number of training epochs

  • patience (int | None) – Iterations without a loss within tolerance from the best found, before stopping early.

  • projected_feature_dimension (int | None) – Dimension to project input features to before training

  • batch_sampling_ratio (float | None) – Ratio of nodes to sample for each training batch

  • store_model_to_disk (bool) – Whether to persist the model to disk

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • batch_size (int) – Number of nodes to process in each batch.

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

Returns:

The estimation result containing memory requirements and other statistics

Return type:

EstimationResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageTrainResult

Bases: BaseResult

configuration: dict[str, Any]
model_info: dict[str, Any]
train_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedEndpoints

Bases:

Endpoints for the unsupervised GraphSage algorithm.

This is the successor of the classic gds.graph_sage.train endpoint.

abstractmethod mutate(G: Graph, model_name: str, feature_properties: list[str], mutate_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageUnsupervisedMutateResult

Uses a pre-trained unsupervised GraphSage model to predict embeddings for a graph and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – Name of the node property to store the results in.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageUnsupervisedMutateResult

abstractmethod stream(G: Graph, model_name: str, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Uses a pre-trained unsupervised GraphSage model to predict embeddings for a graph and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

DataFrame with node IDs and their embeddings

Return type:

pandas.DataFrame

abstractmethod train(G: Graph, model_name: str, feature_properties: list[str], *, epochs: int, activation_function: str = 'relu', aggregator: str = 'mean', batch_size: int | None = None, dropout: float = 0.1, embedding_dimension: int = 256, layer_normalization: bool = True, learning_rate: float = 0.001, negative_sampling_ratio: float = 1.0, num_neighbors: list[int] = [20, 10], num_walks: int = 10, walk_depth: int = 3, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → tuple[GraphSageUnsupervisedModel, GraphSageUnsupervisedTrainResult]

Trains an unsupervised GraphSage model on the given graph.

This is the successor of the classic gds.graph_sage.train endpoint. The resulting model can be used for prediction with gds.graph_sage.unsupervised.stream, .write and .mutate.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the trained model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • epochs (int) – Maximum number of training epochs.

  • activation_function (str) – The activation function to apply after each layer

  • aggregator (str) – The aggregator function for neighborhood aggregation

  • batch_size (int | None) – Number of nodes to process in each batch.

  • dropout (float) – Dropout probability applied during training.

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • layer_normalization (bool) – Whether to apply layer normalization after each layer

  • learning_rate (float) – Learning rate for the training optimization

  • negative_sampling_ratio (float) – Ratio of negative to positive samples for training

  • num_neighbors (list[int]) – Number of neighbors to sample at each layer

  • num_walks (int) – Number of random walks to generate per node

  • walk_depth (int) – Depth of the random walks used for training

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The trained model and training metrics

Return type:

tuple[GraphSageUnsupervisedModel, GraphSageUnsupervisedTrainResult]

abstractmethod write(G: Graph, model_name: str, feature_properties: list[str], write_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageUnsupervisedWriteResult

Uses a pre-trained unsupervised GraphSage model to predict embeddings for a graph and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – Name of the node property to store the results in.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Algorithm metrics and statistics

Return type:

GraphSageUnsupervisedWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedModel

Bases: Model

Represents an unsupervised GraphSage model in the model catalog. Construct this using gds.graph_sage.unsupervised.train.

predict_mutate(G: Graph, feature_properties: list[str], mutate_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageUnsupervisedMutateResult

Generate embeddings for the given graph and mutate the graph with the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – The property to mutate with the embeddings.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the mutate operation.

Return type:

GraphSageUnsupervisedMutateResult

predict_stream(G: Graph, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Generate embeddings for the given graph and stream the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The streaming results as a DataFrame.

Return type:

pandas.DataFrame

predict_write(G: Graph, feature_properties: list[str], write_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageUnsupervisedWriteResult

Generate embeddings for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – The property to write the embeddings to.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the write operation.

Return type:

GraphSageUnsupervisedWriteResult

class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedSessionEndpoints

Bases: GraphSageUnsupervisedEndpoints

Unsupervised GraphSage endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, model_name: str, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • model_name (str) – Name of the model.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedTrainResult

Bases: BaseResult

configuration: dict[str, Any]
pre_processing_millis: int
train_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageUnsupervisedWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.GraphSageWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
node_count: int
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.HashGNNEndpoints

Bases:

abstractmethod estimate(G: Graph | dict[str, Any], iterations: int, embedding_density: int, output_dimension: int | None = None, neighbor_influence: float = 1.0, generate_features: dict[str, Any] | None = None, binarize_features: dict[str, Any] | None = None, heterogeneous: bool = False, feature_properties: list[str] | None = None, random_seed: int | None = None) → EstimationResult

Returns an estimation of the memory consumption for that procedure.

Parameters:
  • G (Graph | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.

  • iterations (int) – Number of iterations to run.

  • embedding_density (int) – The density of the generated embeddings (number of bits per embedding)

  • output_dimension (int | None) – The dimension of the output embeddings.

  • neighbor_influence (float) – The influence of neighboring nodes.

  • generate_features (dict[str, Any] | None) – Configuration for generating synthetic features from existing node properties

  • binarize_features (dict[str, Any] | None) – Configuration for binarizing continuous features

  • heterogeneous (bool) – Whether to use heterogeneous node processing for different node types

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

Returns:

The estimated cost of running the algorithm

Return type:

EstimationResult

abstractmethod mutate(G: Graph, iterations: int, embedding_density: int, mutate_property: str, output_dimension: int | None = None, neighbor_influence: float = 1.0, generate_features: dict[str, Any] | None = None, binarize_features: dict[str, Any] | None = None, heterogeneous: bool = False, feature_properties: list[str] | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, result_as_vector: bool = False) → HashGNNMutateResult

Executes the HashGNN algorithm and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • embedding_density (int) – The density of the generated embeddings (number of bits per embedding)

  • mutate_property (str) – Name of the node property to store the results in.

  • output_dimension (int | None) – The dimension of the output embeddings

  • neighbor_influence (float) – The influence of neighboring nodes

  • generate_features (dict[str, Any] | None) – Configuration for generating synthetic features from existing node properties

  • binarize_features (dict[str, Any] | None) – Configuration for binarizing continuous features

  • heterogeneous (bool) – Whether to use heterogeneous node processing for different node types

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

  • relationship_types (list[str])

  • node_labels (list[str])

  • sudo (bool)

  • log_progress (bool)

  • username (str | None)

  • concurrency (int | None)

  • job_id (str | None)

Returns:

Algorithm metrics and statistics

Return type:

HashGNNMutateResult

abstractmethod stream(G: Graph, iterations: int, embedding_density: int, output_dimension: int | None = None, neighbor_influence: float = 1.0, generate_features: dict[str, Any] | None = None, binarize_features: dict[str, Any] | None = None, heterogeneous: bool = False, feature_properties: list[str] | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, result_as_vector: bool = False) → DataFrame

Executes the HashGNN algorithm and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • embedding_density (int) – The density of the generated embeddings (number of bits per embedding)

  • output_dimension (int | None) – The dimension of the output embeddings

  • neighbor_influence (float) – The influence of neighboring nodes

  • generate_features (dict[str, Any] | None) – Configuration for generating synthetic features from existing node properties

  • binarize_features (dict[str, Any] | None) – Configuration for binarizing continuous features

  • heterogeneous (bool) – Whether to use heterogeneous node processing for different node types

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

  • relationship_types (list[str])

  • node_labels (list[str])

  • sudo (bool)

  • log_progress (bool)

  • username (str | None)

  • concurrency (int | None)

  • job_id (str | None)

Returns:

DataFrame with node IDs and their embeddings

Return type:

pandas.DataFrame

abstractmethod write(G: Graph, iterations: int, embedding_density: int, write_property: str, output_dimension: int | None = None, neighbor_influence: float = 1.0, generate_features: dict[str, Any] | None = None, binarize_features: dict[str, Any] | None = None, heterogeneous: bool = False, feature_properties: list[str] | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, write_concurrency: int | None = None, random_seed: int | None = None, result_as_vector: bool = False) → HashGNNWriteResult

Executes the HashGNN algorithm and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • embedding_density (int) – The density of the generated embeddings (number of bits per embedding)

  • write_property (str) – Name of the node property to store the results in.

  • output_dimension (int | None) – The dimension of the output embeddings. If not specified, defaults to embedding_density / 64

  • neighbor_influence (float) – The influence of neighboring nodes (0.0 to 1.0)

  • generate_features (dict[str, Any] | None) – Configuration for generating synthetic features from existing node properties

  • binarize_features (dict[str, Any] | None) – Configuration for binarizing continuous features

  • heterogeneous (bool) – Whether to use heterogeneous node processing for different node types

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

HashGNNWriteResult

class graphdatascience.procedure_surface.api.node_embedding.HashGNNMutateResult

Bases: BaseResult

Result object representing the results of running a HashGNN algorithm in mutate mode.

compute_millis: int
configuration: dict[str, Any]
mutate_millis: int
node_count: int
node_properties_written: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.HashGNNSessionEndpoints

Bases: HashGNNEndpoints

HashGNN endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, iterations: int, embedding_density: int, *, output_dimension: int | None = None, neighbor_influence: float = 1.0, generate_features: dict[str, Any] | None = None, binarize_features: dict[str, Any] | None = None, heterogeneous: bool = False, feature_properties: list[str] | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, log_progress: bool = True, username: str | None = None, concurrency: int | None = None, job_id: str | None = None, result_as_vector: bool = False) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • embedding_density (int) – The density of the generated embeddings (number of bits per embedding)

  • output_dimension (int | None) – The dimension of the output embeddings

  • neighbor_influence (float) – The influence of neighboring nodes

  • generate_features (dict[str, Any] | None) – Configuration for generating synthetic features from existing node properties

  • binarize_features (dict[str, Any] | None) – Configuration for binarizing continuous features

  • heterogeneous (bool) – Whether to use heterogeneous node processing for different node types

  • feature_properties (list[str] | None) – Names of the node properties to use as input features. Defaults to [] if not specified

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • sudo (bool) – Disable the memory guard.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.HashGNNWriteResult

Bases: BaseResult

Result object representing the results of running a HashGNN algorithm in write mode.

compute_millis: int
configuration: dict[str, Any]
node_count: int
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.api.node_embedding.Node2VecEndpoints

Bases:

abstractmethod estimate(G: Graph | dict[str, Any], iterations: int = 1, negative_sampling_rate: int = 5, positive_sampling_factor: float = 0.001, embedding_dimension: int = 128, embedding_initializer: str = 'NORMALIZED', initial_learning_rate: float = 0.025, min_learning_rate: float = 0.0001, window_size: int = 10, negative_sampling_exponent: float = 0.75, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None, walk_length: int = 80, walks_per_node: int = 10, in_out_factor: float = 1.0, return_factor: float = 1.0, walk_buffer_size: int = 1000, relationship_weight_property: str | None = None, random_seed: int | None = None) → EstimationResult

Returns an estimation of the memory consumption for that procedure.

Parameters:
  • G (Graph | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.

  • iterations (int) – Number of iterations to run.

  • negative_sampling_rate (int) – Number of negative samples for each positive sample

  • positive_sampling_factor (float) – Factor to multiply positive sampling weights

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • embedding_initializer (str) – Strategy for initializing node embeddings. Either “UNIFORM” or “NORMALIZED”

  • initial_learning_rate (float) – The initial learning rate

  • min_learning_rate (float) – The minimum learning rate

  • window_size (int) – Size of the context window

  • negative_sampling_exponent (float) – Exponent for negative sampling probability distribution

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • concurrency (int | None) – Number of concurrent threads to use.

  • walk_length (int) – The length of each random walk

  • walks_per_node (int) – Number of walks to sample for each node

  • in_out_factor (float) – Controls the likelihood of immediately revisiting a node in the walk

  • return_factor (float) – Controls the likelihood of visiting already visited nodes

  • walk_buffer_size (int) – Buffer size for walk sampling

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

Returns:

Memory estimation details

Return type:

EstimationResult

abstractmethod mutate(G: Graph, mutate_property: str, iterations: int = 1, negative_sampling_rate: int = 5, positive_sampling_factor: float = 0.001, embedding_dimension: int = 128, embedding_initializer: str = 'NORMALIZED', initial_learning_rate: float = 0.025, min_learning_rate: float = 0.0001, window_size: int = 10, negative_sampling_exponent: float = 0.75, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, walk_length: int = 80, walks_per_node: int = 10, in_out_factor: float = 1.0, return_factor: float = 1.0, walk_buffer_size: int = 1000, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → Node2VecMutateResult

Executes the Node2Vec algorithm and writes the results back to the graph as a node property.

Parameters:
  • G (Graph) – Graph object to use

  • mutate_property (str) – Name of the node property to store the results in.

  • iterations (int) – Number of iterations to run.

  • negative_sampling_rate (int) – Number of negative samples for each positive sample

  • positive_sampling_factor (float) – Factor to multiply positive sampling weights

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • embedding_initializer (str) – Strategy for initializing node embeddings. Either “UNIFORM” or “NORMALIZED”

  • initial_learning_rate (float) – The initial learning rate

  • min_learning_rate (float) – The minimum learning rate

  • window_size (int) – Size of the context window

  • negative_sampling_exponent (float) – Exponent for negative sampling probability distribution

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • walk_length (int) – The length of each random walk

  • walks_per_node (int) – Number of walks to sample for each node

  • in_out_factor (float) – Controls the likelihood of immediately revisiting a node in the walk

  • return_factor (float) – Controls the likelihood of visiting already visited nodes

  • walk_buffer_size (int) – Buffer size for walk sampling

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Algorithm metrics and statistics

Return type:

Node2VecMutateResult

abstractmethod stream(G: Graph, iterations: int = 1, negative_sampling_rate: int = 5, positive_sampling_factor: float = 0.001, embedding_dimension: int = 128, embedding_initializer: str = 'NORMALIZED', initial_learning_rate: float = 0.025, min_learning_rate: float = 0.0001, window_size: int = 10, negative_sampling_exponent: float = 0.75, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, walk_length: int = 80, walks_per_node: int = 10, in_out_factor: float = 1.0, return_factor: float = 1.0, walk_buffer_size: int = 1000, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → DataFrame

Executes the Node2Vec algorithm and returns the results as a stream.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • negative_sampling_rate (int) – Number of negative samples for each positive sample

  • positive_sampling_factor (float) – Factor to multiply positive sampling weights

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • embedding_initializer (str) – Strategy for initializing node embeddings. Either “UNIFORM” or “NORMALIZED”

  • initial_learning_rate (float) – The initial learning rate

  • min_learning_rate (float) – The minimum learning rate

  • window_size (int) – Size of the context window

  • negative_sampling_exponent (float) – Exponent for negative sampling probability distribution

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • walk_length (int) – The length of each random walk

  • walks_per_node (int) – Number of walks to sample for each node

  • in_out_factor (float) – Controls the likelihood of immediately revisiting a node in the walk

  • return_factor (float) – Controls the likelihood of visiting already visited nodes

  • walk_buffer_size (int) – Buffer size for walk sampling

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Embeddings as a stream with columns nodeId and embedding

Return type:

pandas.DataFrame

abstractmethod write(G: Graph, write_property: str, iterations: int = 1, negative_sampling_rate: int = 5, positive_sampling_factor: float = 0.001, embedding_dimension: int = 128, embedding_initializer: str = 'NORMALIZED', initial_learning_rate: float = 0.025, min_learning_rate: float = 0.0001, window_size: int = 10, negative_sampling_exponent: float = 0.75, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, walk_length: int = 80, walks_per_node: int = 10, in_out_factor: float = 1.0, return_factor: float = 1.0, walk_buffer_size: int = 1000, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False, write_concurrency: int | None = None) → Node2VecWriteResult

Executes the Node2Vec algorithm and writes the results back to the database.

Parameters:
  • G (Graph) – Graph object to use

  • write_property (str) – Name of the node property to store the results in.

  • iterations (int) – Number of iterations to run.

  • negative_sampling_rate (int) – Number of negative samples for each positive sample

  • positive_sampling_factor (float) – Factor to multiply positive sampling weights

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • embedding_initializer (str) – Strategy for initializing node embeddings. Either “UNIFORM” or “NORMALIZED”

  • initial_learning_rate (float) – The initial learning rate

  • min_learning_rate (float) – The minimum learning rate

  • window_size (int) – Size of the context window

  • negative_sampling_exponent (float) – Exponent for negative sampling probability distribution

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • walk_length (int) – The length of each random walk

  • walks_per_node (int) – Number of walks to sample for each node

  • in_out_factor (float) – Controls the likelihood of immediately revisiting a node in the walk

  • return_factor (float) – Controls the likelihood of visiting already visited nodes

  • walk_buffer_size (int) – Buffer size for walk sampling

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.Returns

  • -------

  • Node2VecWriteResult – Algorithm metrics and statistics

Return type:

Node2VecWriteResult

class graphdatascience.procedure_surface.api.node_embedding.Node2VecMutateResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
loss_per_iteration: list[float]
mutate_millis: int
node_count: int
node_properties_written: int
post_processing_millis: int
pre_processing_millis: int
class graphdatascience.procedure_surface.api.node_embedding.Node2VecSessionEndpoints

Bases: Node2VecEndpoints

Node2Vec endpoints as exposed by a GDS Session.

abstractmethod compute(G: Graph, *, iterations: int = 1, negative_sampling_rate: int = 5, positive_sampling_factor: float = 0.001, embedding_dimension: int = 128, embedding_initializer: str = 'NORMALIZED', initial_learning_rate: float = 0.025, min_learning_rate: float = 0.0001, window_size: int = 10, negative_sampling_exponent: float = 0.75, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, walk_length: int = 80, walks_per_node: int = 10, in_out_factor: float = 1.0, return_factor: float = 1.0, walk_buffer_size: int = 1000, relationship_weight_property: str | None = None, random_seed: int | None = None, result_as_vector: bool = False) → JobHandle

Starts the computation as a job and returns a handle to it.

The computation runs without materializing its result. Use the returned handle to mutate, write or stream the result afterwards.

Parameters:
  • G (Graph) – Graph object to use

  • iterations (int) – Number of iterations to run.

  • negative_sampling_rate (int) – Number of negative samples for each positive sample

  • positive_sampling_factor (float) – Factor to multiply positive sampling weights

  • embedding_dimension (int) – Output dimensionality of the embeddings

  • embedding_initializer (str) – Strategy for initializing node embeddings. Either “UNIFORM” or “NORMALIZED”

  • initial_learning_rate (float) – The initial learning rate

  • min_learning_rate (float) – The minimum learning rate

  • window_size (int) – Size of the context window

  • negative_sampling_exponent (float) – Exponent for negative sampling probability distribution

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • log_progress (bool) – Display progress logging.

  • sudo (bool) – Disable the memory guard.

  • concurrency (int | None) – Number of concurrent threads to use.

  • job_id (str | None) – Identifier for the computation.

  • walk_length (int) – The length of each random walk

  • walks_per_node (int) – Number of walks to sample for each node

  • in_out_factor (float) – Controls the likelihood of immediately revisiting a node in the walk

  • return_factor (float) – Controls the likelihood of visiting already visited nodes

  • walk_buffer_size (int) – Buffer size for walk sampling

  • relationship_weight_property (str | None) – Name of the property to be used as weights.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • result_as_vector (bool) – Whether to produce the embeddings as vector values instead of lists of floats. Requires GDS 2026.11 or later.

Returns:

Handle to the started computation

Return type:

JobHandle

class graphdatascience.procedure_surface.api.node_embedding.Node2VecWriteResult

Bases: BaseResult

compute_millis: int
configuration: dict[str, Any]
loss_per_iteration: list[float]
node_count: int
node_properties_written: int
pre_processing_millis: int
write_millis: int
class graphdatascience.procedure_surface.arrow.node_embedding.graphsage_session_endpoints.GraphSageSessionEndpoints

Bases: GraphSageEndpoints

API for the GraphSage algorithm in GDS Sessions, combining classic training and prediction with the unsupervised GraphSage endpoints (the successor of the classic gds.graph_sage.train) and the supervised (node classification) GraphSage endpoints.

compute(G: Graph, model_name: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], username: str | None = None, log_progress: bool = True, sudo: bool = False, concurrency: int | None = None, job_id: str | None = None, batch_size: int = 100, result_as_vector: bool = False) → JobHandle

Start a classic GraphSage prediction and return a JobHandle.

The handle exposes stream / mutate / write so the caller can decide how to materialize the prediction after the computation is started.

Parameters:
Return type:

JobHandle

property supervised: GraphSageSupervisedSessionEndpoints

Endpoints for the supervised (node classification) GraphSage.

Return type:

GraphSageSupervisedSessionEndpoints

property unsupervised: GraphSageUnsupervisedSessionEndpoints

Endpoints for the unsupervised GraphSage.

Return type:

GraphSageUnsupervisedSessionEndpoints

class graphdatascience.procedure_surface.api.node_embedding.graphsage_model.GraphSageModel

Represents a GraphSAGE model in the model catalog. Construct this using gds.v2.graphSage.train().

predict_estimate(G: Graph, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → EstimationResult

Estimate the memory needed to generate embeddings for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • relationship_types (list[str]) – The relationship types to consider.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The memory needed to generate embeddings for the given graph and write the results to the database.

Return type:

EstimationResult

predict_mutate(G: Graph, mutate_property: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → GraphSageMutateResult

Generate embeddings for the given graph and mutate the graph with the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • mutate_property (str) – The property to mutate with the embeddings.

  • relationship_types (list[str]) – The relationship types to consider.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The result of the mutate operation.

Return type:

GraphSageMutateResult

predict_stream(G: Graph, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → DataFrame

Generate embeddings for the given graph and stream the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • relationship_types (list[str]) – The relationship types to consider.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The streaming results as a DataFrame.

Return type:

pandas.DataFrame

predict_write(G: Graph, write_property: str, *, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], batch_size: int = 100, concurrency: int | None = None, write_concurrency: int | None = None, log_progress: bool = True, username: str | None = None, sudo: bool = False, job_id: str | None = None) → GraphSageWriteResult

Generate embeddings for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • write_property (str) – The property to write the embeddings to.

  • relationship_types (list[str]) – The relationship types to consider.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • batch_size (int) – The batch size for prediction.

  • concurrency (int | None) – Number of concurrent threads to use.

  • write_concurrency (int | None) – The concurrency for writing.

  • log_progress (bool) – Display progress logging.

  • username (str | None) – As an administrator, impersonate a different user for accessing their graphs.

  • sudo (bool) – Disable the memory guard.

  • job_id (str | None) – Identifier for the computation.

Returns:

The result of the write operation.

Return type:

GraphSageWriteResult

class graphdatascience.procedure_surface.api.node_embedding.graphsage_unsupervised_model.GraphSageUnsupervisedModel

Represents an unsupervised GraphSage model in the model catalog. Construct this using gds.graph_sage.unsupervised.train.

predict_mutate(G: Graph, feature_properties: list[str], mutate_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageUnsupervisedMutateResult

Generate embeddings for the given graph and mutate the graph with the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – The property to mutate with the embeddings.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the mutate operation.

Return type:

GraphSageUnsupervisedMutateResult

predict_stream(G: Graph, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Generate embeddings for the given graph and stream the results.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The streaming results as a DataFrame.

Return type:

pandas.DataFrame

predict_write(G: Graph, feature_properties: list[str], write_property: str, *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageUnsupervisedWriteResult

Generate embeddings for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to generate embeddings for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – The property to write the embeddings to.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the write operation.

Return type:

GraphSageUnsupervisedWriteResult

class graphdatascience.procedure_surface.api.node_embedding.graphsage_supervised_model.GraphSageSupervisedModel

Represents a supervised (node classification) GraphSage model in the model catalog. Construct this using gds.graph_sage.supervised.train.

predict_mutate(G: Graph, feature_properties: list[str], mutate_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → GraphSageSupervisedMutateResult

Predict classes for the given graph and mutate the graph with the results.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • mutate_property (str) – The property to mutate with the predicted classes.

  • predicted_probability_property (str | None) – The property to mutate with the predicted class probabilities.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the mutate operation.

Return type:

GraphSageSupervisedMutateResult

predict_stream(G: Graph, feature_properties: list[str], *, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, gpu: bool = False) → DataFrame

Predict classes for the given graph and stream the results.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The streaming results as a DataFrame with node IDs, predicted classes and predicted class probabilities.

Return type:

pandas.DataFrame

predict_write(G: Graph, feature_properties: list[str], write_property: str, *, predicted_probability_property: str | None = None, batch_size: int | None = None, random_seed: int | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], job_id: str | None = None, write_concurrency: int | None = None, gpu: bool = False) → GraphSageSupervisedWriteResult

Predict classes for the given graph and write the results to the database.

Parameters:
  • G (Graph) – The graph to predict classes for.

  • feature_properties (list[str]) – Names of the node properties to use as input features

  • write_property (str) – The property to write the predicted classes to.

  • predicted_probability_property (str | None) – The property to write the predicted class probabilities to.

  • batch_size (int | None) – Number of nodes to process in each batch.

  • random_seed (int | None) – Seed for random number generation to ensure reproducible results.

  • relationship_types (list[str]) – Filter the graph using the given relationship types. Relationships with any of the given types will be included.

  • node_labels (list[str]) – Filter the graph using the given node labels. Nodes with any of the given labels will be included.

  • job_id (str | None) – Identifier for the computation.

  • write_concurrency (int | None) – Number of concurrent threads to use for writing.

  • gpu (bool) – Whether to opt the algorithm run using GPU Experimental: To enable this feature for your project, contact your Neo4j account team or submit a request using the Feedback button in the Aura console.

Returns:

The result of the write operation.

Return type:

GraphSageSupervisedWriteResult

class graphdatascience.embedding.FastRPConfig

Configuration for the FastRP graph encoder.

coefficients: list[float] | None
graph_encoder_type: Literal['fast_rp']
normalization_strength: float | None
out_dim: Annotated[int, Gt(gt=0)] | None
class graphdatascience.embedding.GraphSAGEConfig

Configuration for the GraphSAGE graph encoder.

dropout: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0.0), Lt(lt=1.0)])] | None
graph_encoder_type: Literal['graphsage']
hidden_dims: Annotated[list[Annotated[int, Gt(gt=0)]], Len(min_length=0, max_length=3)] | None
num_neighbors: Annotated[list[Annotated[int, Gt(gt=0)]], Len(min_length=1, max_length=4)] | None
out_dim: Annotated[int, Gt(gt=0)] | None
class graphdatascience.embedding.MLPClassifierConfig

Configuration for the multi-layer perceptron classifier decoder.

decoder_type: Literal['mlp_classifier']
dropout: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0.0), Lt(lt=1.0)])] | None
hidden_dims: list[Annotated[int, Gt(gt=0)]] | None