Pathfinding Algorithms

pydantic model graphdatascience.procedure_surface.api.pathfinding.AStarMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.AStarWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.AllShortestPathEndpoints

Container for shortest path algorithm endpoints from a given source node. Provides access to different shortest path algorithms such as Delta Stepping, Dijkstra, and Bellman-Ford.

abstract property delta: SingleSourceDeltaEndpoints

Access to Delta Stepping shortest path algorithm endpoints.

abstract property dijkstra: SingleSourceDijkstraEndpoints

Access to Dijkstra shortest path algorithm endpoints.

abstract estimate(G: Graph | dict[str, Any], *, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimate memory requirements for the All Shortest Paths algorithm.

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

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

  • job_id – Identifier for the computation.

  • log_progress – Display progress logging.

  • 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.

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

  • sudo (bool) – Disable the memory guard.

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

Returns:

An estimation result object containing memory and resource usage estimates.

Return type:

EstimationResult

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

Executes the All Shortest Paths algorithm and returns a stream of results.

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

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

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

  • sudo (bool) – Disable the memory guard.

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

Returns:

DataFrame with the algorithm results containing ‘sourceNodeId’, ‘targetNodeId’, and ‘distance’ columns

Return type:

pandas.DataFrame

class graphdatascience.procedure_surface.api.pathfinding.BFSEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) → EstimationResult

Estimate the memory consumption of an algorithm run.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the BFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Memory estimation details

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, 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) → BFSMutateResult

Runs the Breadth First Search (BFS) algorithm and stores the results as new relationships in the graph catalog.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the BFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Algorithm metrics and statistics

Return type:

BFSMutateResult

abstract stats(G: Graph, source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, 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) → BFSStatsResult

Runs the Breadth First Search (BFS) algorithm and returns result statistics without storing the results.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the BFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Algorithm statistics

Return type:

BFSStatsResult

abstract stream(G: Graph, source_node: int, target_nodes: int | list[int] | None = None, max_depth: int = -1, 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) → DataFrame

Runs the Breadth First Search (BFS) algorithm and returns a stream of results.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int] | None) – A single target node or a list of target nodes for the BFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

DataFrame with sourceNode and nodeIds columns.

Return type:

pandas.DataFrame

pydantic model graphdatascience.procedure_surface.api.pathfinding.BFSMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.BFSStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field contains_negative_cycle: bool
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field contains_negative_cycle: bool
field post_processing_millis: int
field pre_processing_millis: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field contains_negative_cycle: bool
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.DFSEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) → EstimationResult

Estimate the memory consumption of an algorithm run.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the DFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Memory estimation details

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, 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) → DFSMutateResult

Runs the Depth First Search (DFS) algorithm and stores the results as new relationships in the graph catalog.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the DFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Algorithm metrics and statistics

Return type:

DFSMutateResult

abstract stats(G: Graph, source_node: int, target_nodes: int | list[int] = [], max_depth: int = -1, 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) → DFSStatsResult

Runs the Depth First Search (DFS) algorithm and returns result statistics without storing the results.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the DFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

Algorithm statistics

Return type:

DFSStatsResult

abstract stream(G: Graph, source_node: int, target_nodes: int | list[int] | None = None, max_depth: int = -1, 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) → DataFrame

Runs the Depth First Search (DFS) algorithm and returns a stream of results.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int] | None) – A single target node or a list of target nodes for the DFS computation.

  • max_depth (int) – The maximum depth of the search.

  • 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.

Returns:

DataFrame with sourceNode and nodeIds columns.

Return type:

pandas.DataFrame

pydantic model graphdatascience.procedure_surface.api.pathfinding.DFSMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.DFSStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
class graphdatascience.procedure_surface.api.pathfinding.DagEndpoints

Container for Directed Acyclic Graph (DAG) algorithm endpoints.

abstract property longest_path: LongestPathEndpoints

Access to Longest Path algorithm endpoints for DAGs.

abstract property topological_sort: TopologicalSortEndpoints

Access to Topological Sort algorithm endpoints for DAGs.

pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.DijkstraEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_nodes: int | list[int], relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Dijkstra shortest path algorithm.

The Dijkstra algorithm computes the shortest path(s) from a source node to one or more target nodes in a weighted graph.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_nodes: int | list[int], relationship_weight_property: 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) → DijkstraMutateResult

Runs the Dijkstra shortest path algorithm and stores the results as new relationships in the graph catalog.

The Dijkstra algorithm computes the shortest path(s) from a source node to one or more target nodes in a weighted graph and creates relationships representing the paths in the in-memory graph.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

DijkstraMutateResult

abstract stream(G: Graph, source_node: int, target_nodes: int | list[int], relationship_weight_property: 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) → DataFrame

Runs the Dijkstra shortest path algorithm and returns the result as a DataFrame.

The Dijkstra algorithm computes the shortest path(s) from a source node to one or more target nodes in a weighted graph.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, source_node: int, target_nodes: int | list[int], write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → DijkstraWriteResult

Runs the Dijkstra shortest path algorithm and writes the results back to the database.

The Dijkstra algorithm computes the shortest path(s) from a source node to one or more target nodes in a weighted graph and writes the path as relationships.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

  • write_node_ids (bool) – Whether to write node IDs along the path.

  • write_costs (bool) – Whether to write costs along the path.

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

  • 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.Returns

  • -------

  • DijkstraWriteResult – Object containing metadata from the execution.

Return type:

DijkstraWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraStreamResult
field costs: list[float]
field index: int
field node_ids: list[int]
field path: list[int]
field source_node: int
field target_node: int
field total_cost: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.KSpanningTreeEndpoints
abstract write(G: Graph, k: int, write_property: str, source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', 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) → KSpanningTreeWriteResult

Runs the k-Spanning tree algorithm and writes the result back to the Neo4j database.

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

  • k (int) – Number of spanning trees to compute.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.Returns

  • -------

  • KSpanningTreeWriteResult – Result containing statistics and timing information.

Return type:

KSpanningTreeWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.KSpanningTreeWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field post_processing_millis: int
field pre_processing_millis: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.LongestPathEndpoints
abstract stream(G: Graph, *, relationship_weight_property: 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) → DataFrame

Runs the longest path algorithm in a DAG and returns the result as a DataFrame.

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

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

  • 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.

Returns:

The longest path results as a DataFrame with columns for index, sourceNode, targetNode, totalCost, nodeIds, costs.

Return type:

pandas.DataFrame

class graphdatascience.procedure_surface.api.pathfinding.MaxFlowEndpoints
abstract estimate(G: Graph | dict[str, Any], source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, concurrency: int | None = None, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*']) → EstimationResult

Estimate the memory consumption of an algorithm run.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

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

  • 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.

Returns:

Memory estimation details

Return type:

EstimationResult

abstract property min_cost: MaxFlowMinCostEndpoints

Container for Min-Cost Max Flow algorithm endpoints.

abstract mutate(G: Graph, source_nodes: list[int], target_nodes: list[int], mutate_property: str, mutate_relationship_type: str, *, capacity_property: str | None = None, node_capacity_property: str | None = None, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → MaxFlowMutateResult

Runs the Max Flow algorithm and stores the results in the graph catalog.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowMutateResult

abstract stats(G: Graph, source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → MaxFlowStatsResult

Runs the Max Flow algorithm and returns statistics.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowStatsResult

abstract stream(G: Graph, source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → DataFrame

Runs the Max Flow algorithm and returns a stream of results.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

Returns:

DataFrame with the algorithm results containing ‘source’, ‘target’, and ‘flow’ columns

Return type:

pandas.DataFrame

abstract write(G: Graph, source_nodes: list[int], target_nodes: list[int], write_property: str, write_relationship_type: str, *, capacity_property: str | None = None, node_capacity_property: str | None = None, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None, write_concurrency: int | None = None) → MaxFlowWriteResult

Runs the Max Flow algorithm and writes the results to the Neo4j database.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

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

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowWriteResult

class graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostEndpoints
abstract estimate(G: Graph | dict[str, Any], source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, cost_property: str | None = None, alpha: int = 6, concurrency: int | None = None, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*']) → EstimationResult

Estimate the memory consumption of an algorithm run.

Parameters:
Return type:

EstimationResult

abstract mutate(G: Graph, source_nodes: list[int], target_nodes: list[int], mutate_property: str, mutate_relationship_type: str, *, capacity_property: str | None = None, node_capacity_property: str | None = None, cost_property: str | None = None, alpha: int = 6, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → MaxFlowMinCostMutateResult

Runs the Min-Cost Max Flow algorithm and stores the results in the graph catalog.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

  • cost_property (str | None) – Name of the relationship property containing costs.

  • alpha (int) – Rate of cost-scaling in the refinement phase of the algorithm. Tuning can improve speed.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowMinCostMutateResult

abstract stats(G: Graph, source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, cost_property: str | None = None, alpha: int = 6, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → MaxFlowMinCostStatsResult

Runs the Min-Cost Max Flow algorithm and returns statistics.

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

  • source_nodes (list[int]) – List of source node IDs.

  • target_nodes (list[int]) – List of target node IDs.

  • capacity_property (str | None) – Name of the relationship property containing capacities.

  • node_capacity_property (str | None) – Name of the node property containing capacities.

  • cost_property (str | None) – Name of the relationship property containing costs.

  • alpha (int) – Rate of cost-scaling in the refinement phase of the algorithm. Tuning can improve speed.

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

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

  • log_progress (bool) – Display progress logging.

  • 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.

  • sudo (bool) – Disable the memory guard.

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

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowMinCostStatsResult

abstract stream(G: Graph, source_nodes: list[int], target_nodes: list[int], *, capacity_property: str | None = None, node_capacity_property: str | None = None, cost_property: str | None = None, alpha: int = 6, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None) → DataFrame

Runs the Min-Cost Max Flow algorithm and streams the flows on relationships.

Returns:

Dataframe containing source, target, and flow per relationship.

Return type:

pandas.DataFrame

Parameters:
  • G (Graph)

  • source_nodes (list[int])

  • target_nodes (list[int])

  • capacity_property (str | None)

  • node_capacity_property (str | None)

  • cost_property (str | None)

  • alpha (int)

  • concurrency (int | None)

  • job_id (str | None)

  • log_progress (bool)

  • node_labels (list[str])

  • relationship_types (list[str])

  • sudo (bool)

  • username (str | None)

abstract write(G: Graph, source_nodes: list[int], target_nodes: list[int], write_property: str, write_relationship_type: str, *, capacity_property: str | None = None, node_capacity_property: str | None = None, cost_property: str | None = None, alpha: int = 6, concurrency: int | None = None, job_id: str | None = None, log_progress: bool = True, node_labels: list[str] = ['*'], relationship_types: list[str] = ['*'], sudo: bool = False, username: str | None = None, write_concurrency: int | None = None) → MaxFlowMinCostWriteResult

Runs the Min-Cost Max Flow algorithm and writes the results to the Neo4j database.

Returns:

Algorithm metrics and statistics

Return type:

MaxFlowMinCostWriteResult

Parameters:
  • G (Graph)

  • source_nodes (list[int])

  • target_nodes (list[int])

  • write_property (str)

  • write_relationship_type (str)

  • capacity_property (str | None)

  • node_capacity_property (str | None)

  • cost_property (str | None)

  • alpha (int)

  • concurrency (int | None)

  • job_id (str | None)

  • log_progress (bool)

  • node_labels (list[str])

  • relationship_types (list[str])

  • sudo (bool)

  • username (str | None)

  • write_concurrency (int | None)

pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field pre_processing_millis: int
field relationships_written: int
field total_cost: float
field total_flow: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field pre_processing_millis: int
field total_cost: float
field total_flow: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field pre_processing_millis: int
field relationships_written: int
field total_cost: float
field total_flow: float
field write_millis: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field pre_processing_millis: int
field relationships_written: int
field total_flow: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field total_flow: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field pre_processing_millis: int
field relationships_written: int
field total_flow: float
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeEndpoints
abstract estimate(G: Graph | dict[str, Any], prize_property: str, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Prize Steiner tree algorithm.

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

  • prize_property (str) – The name of the node property containing prize values.

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

  • 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.

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

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

Returns:

Memory estimation results including required bytes and percentages.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, mutate_property: str, prize_property: str, relationship_weight_property: 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) → PrizeSteinerTreeMutateResult

Runs the Prize Steiner tree algorithm and adds the result as new relationships to the in-memory graph.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

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

  • prize_property (str) – The name of the node property containing prize values.

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

  • 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.

Returns:

Result containing statistics and timing information.

Return type:

PrizeSteinerTreeMutateResult

abstract stats(G: Graph, prize_property: str, relationship_weight_property: 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) → PrizeSteinerTreeStatsResult

Runs the Prize Steiner tree algorithm in stats mode, returning statistics without modifying the graph.

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

  • prize_property (str) – The name of the node property containing prize values.

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

  • 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.

Returns:

Statistics about the computed Prize Steiner tree.

Return type:

PrizeSteinerTreeStatsResult

abstract stream(G: Graph, prize_property: str, relationship_weight_property: 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) → DataFrame

Runs the Prize Steiner tree algorithm and returns the result as a DataFrame.

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

  • prize_property (str) – The name of the node property containing prize values.

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

  • 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.

Returns:

A DataFrame containing the tree edges with columns: nodeId, parentId, weight.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, write_property: str, prize_property: str, relationship_weight_property: 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) → PrizeSteinerTreeWriteResult

Runs the Prize Steiner tree algorithm and writes the result back to the Neo4j database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

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

  • prize_property (str) – The name of the node property containing prize values.

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

  • 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.Returns

  • -------

  • PrizeSteinerTreeWriteResult – Result containing statistics and timing information.

Return type:

PrizeSteinerTreeWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field mutate_millis: int
field pre_processing_millis: int
field relationships_written: int
field sum_of_prizes: float
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field pre_processing_millis: int
field sum_of_prizes: float
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field pre_processing_millis: int
field relationships_written: int
field sum_of_prizes: float
field total_weight: float
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.RandomWalkEndpoints
abstract estimate(G: Graph | dict[str, Any], source_nodes: int | list[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, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], concurrency: int | None = None) → EstimationResult

Estimate the memory consumption of an algorithm run.

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

  • source_nodes (int | list[int] | None) – Nodes to start the random walks from. If not specified, walks start from every node.

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

  • walks_per_node (int) – The 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.

  • 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.

Returns:

Memory estimation details

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_property: str, source_nodes: int | list[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, 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) → RandomWalkMutateResult

Runs the Random Walk algorithm and stores the results as a new node property in the graph catalog.

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

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

  • source_nodes (int | list[int] | None) – Nodes to start the random walks from. If not specified, walks start from every node.

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

  • walks_per_node (int) – The 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.

  • 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.

Returns:

Algorithm metrics and statistics

Return type:

RandomWalkMutateResult

abstract stats(G: Graph, source_nodes: int | list[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, 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) → RandomWalkStatsResult

Runs the Random Walk algorithm and returns result statistics without storing the results.

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

  • source_nodes (int | list[int] | None) – Nodes to start the random walks from. If not specified, walks start from every node.

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

  • walks_per_node (int) – The 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.

  • 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.

Returns:

Algorithm statistics

Return type:

RandomWalkStatsResult

abstract stream(G: Graph, source_nodes: int | list[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, 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) → DataFrame

Runs the Random Walk algorithm and returns a stream of results.

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

  • source_nodes (int | list[int] | None) – Nodes to start the random walks from. If not specified, walks start from every node.

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

  • walks_per_node (int) – The 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.

  • 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.

Returns:

DataFrame with nodeIds and path columns.

Return type:

pandas.DataFrame

pydantic model graphdatascience.procedure_surface.api.pathfinding.RandomWalkMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field node_properties_written: int
field post_processing_millis: int
field pre_processing_millis: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.RandomWalkStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field pre_processing_millis: int
class graphdatascience.procedure_surface.api.pathfinding.ShortestPathEndpoints

Container for shortest path algorithm endpoints. Provides access to different shortest path algorithms such as Dijkstra and A*.

abstract property a_star: SourceTargetAStarEndpoints

Access to A* shortest path algorithm endpoints.

abstract property dijkstra: SourceTargetDijkstraEndpoints

Access to Dijkstra shortest path algorithm endpoints.

abstract property yens: SourceTargetYensEndpoints

Access to Yen’s K shortest paths algorithm endpoints.

class graphdatascience.procedure_surface.api.pathfinding.SingleSourceBellmanFordEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Bellman-Ford shortest path algorithm.

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

  • source_node (int) – Node id to use as the starting point.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, mutate_negative_cycles: bool = False, relationship_weight_property: 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) → BellmanFordMutateResult

Runs the Bellman-Ford shortest path algorithm and stores the results as new relationships in the graph catalog.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • mutate_negative_cycles (bool) – Whether to write negative cycles to the in-memory graph.

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

  • 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.

Returns:

Object containing metadata from the execution, including whether negative cycles were detected.

Return type:

BellmanFordMutateResult

abstract stats(G: Graph, source_node: int, relationship_weight_property: 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) → BellmanFordStatsResult

Runs the Bellman-Ford shortest path algorithm and returns statistics about the execution.

The Bellman-Ford algorithm can detect negative cycles in the graph.

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

  • source_node (int) – Node id to use as the starting point.

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

  • 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.

Returns:

Object containing statistics from the execution, including whether negative cycles were detected.

Return type:

BellmanFordStatsResult

abstract stream(G: Graph, source_node: int, relationship_weight_property: 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) → DataFrame

Runs the Bellman-Ford shortest path algorithm and returns the result as a DataFrame.

The Bellman-Ford algorithm can detect negative cycles in the graph.

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

  • source_node (int) – Node id to use as the starting point.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index, and isNegativeCycle.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, source_node: int, write_node_ids: bool = False, write_costs: bool = False, write_negative_cycles: bool = False, relationship_weight_property: 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) → BellmanFordWriteResult

Runs the Bellman-Ford shortest path algorithm and writes the results back to the database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship.

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship.

  • write_negative_cycles (bool) – Whether to write negative cycles to the database.

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

  • 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.Returns

  • -------

  • BellmanFordWriteResult – Object containing metadata from the execution, including whether negative cycles were detected.

Return type:

BellmanFordWriteResult

class graphdatascience.procedure_surface.api.pathfinding.SingleSourceDeltaEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, *, delta: float = 2.0, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Delta Stepping shortest path algorithm.

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

  • source_node (int) – Node id to use as the starting point.

  • delta (float) – The bucket width for grouping nodes by tentative distance.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, source_node: int, mutate_relationship_type: str, *, delta: float = 2.0, relationship_weight_property: 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) → DeltaSteppingMutateResult

Runs the Delta Stepping shortest path algorithm and stores the results as new relationships in the graph catalog.

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

  • source_node (int) – Node id to use as the starting point.

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • delta (float) – The bucket width for grouping nodes by tentative distance.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

DeltaSteppingMutateResult

abstract stats(G: Graph, source_node: int, *, delta: float = 2.0, relationship_weight_property: 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) → DeltaSteppingStatsResult

Runs the Delta Stepping shortest path algorithm and returns statistics about the execution.

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

  • source_node (int) – Node id to use as the starting point.

  • delta (float) – The bucket width for grouping nodes by tentative distance.

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

  • 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.

Returns:

Object containing statistics from the execution.

Return type:

DeltaSteppingStatsResult

abstract stream(G: Graph, source_node: int, *, delta: float = 2.0, relationship_weight_property: 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) → DataFrame

Runs the Delta Stepping shortest path algorithm and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

  • delta (float) – The bucket width for grouping nodes by tentative distance.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, source_node: int, write_relationship_type: str, *, delta: float = 2.0, write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → DeltaSteppingWriteResult

Runs the Delta Stepping shortest path algorithm and writes the results back to the database.

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

  • source_node (int) – Node id to use as the starting point.

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • delta (float) – The bucket width for grouping nodes by tentative distance.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship.

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship.

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

  • 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.Returns

  • -------

  • DeltaSteppingWriteResult – Object containing metadata from the execution.

Return type:

DeltaSteppingWriteResult

class graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, *, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Dijkstra shortest path algorithm.

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

  • source_node (int) – Node id to use as the starting point.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, source_node: int, mutate_relationship_type: str, *, relationship_weight_property: 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) → SingleSourceDijkstraMutateResult

Runs the Dijkstra shortest path algorithm and stores the results as new relationships in the graph catalog.

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

  • source_node (int) – Node id to use as the starting point.

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

SingleSourceDijkstraMutateResult

abstract stream(G: Graph, source_node: int, *, relationship_weight_property: 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) → DataFrame

Runs the Dijkstra shortest path algorithm and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, source_node: int, write_relationship_type: str, *, write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → SingleSourceDijkstraWriteResult

Runs the Dijkstra shortest path algorithm and writes the results back to the database.

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

  • source_node (int) – Node id to use as the starting point.

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship.

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship.

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

  • 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.Returns

  • -------

  • SingleSourceDijkstraWriteResult – Object containing metadata from the execution.

Return type:

SingleSourceDijkstraWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.SourceTargetAStarEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_node: int, latitude_property: str, longitude_property: str, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the A* shortest path algorithm.

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

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • latitude_property (str) – The node property that stores latitude values.

  • longitude_property (str) – The node property that stores longitude values.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_node: int, latitude_property: str, longitude_property: str, relationship_weight_property: 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) → AStarMutateResult

Runs the A* shortest path algorithm and stores the results as new relationships in the graph catalog.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • latitude_property (str) – The node property that stores latitude values.

  • longitude_property (str) – The node property that stores longitude values.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

AStarMutateResult

abstract stream(G: Graph, source_node: int, target_node: int, latitude_property: str, longitude_property: str, relationship_weight_property: 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) → DataFrame

Runs the A* shortest path algorithm and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • latitude_property (str) – The node property that stores latitude values.

  • longitude_property (str) – The node property that stores longitude values.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, source_node: int, target_node: int, latitude_property: str, longitude_property: str, write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → AStarWriteResult

Runs the A* shortest path algorithm and writes the results back to the database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • latitude_property (str) – The node property that stores latitude values.

  • longitude_property (str) – The node property that stores longitude values.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship.

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship.

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

  • 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.Returns

  • -------

  • AStarWriteResult – Object containing metadata from the execution.

Return type:

AStarWriteResult

class graphdatascience.procedure_surface.api.pathfinding.SourceTargetDijkstraEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_nodes: int | list[int], relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Dijkstra shortest path algorithm for a source node to one or more target nodes.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_nodes: int | list[int], relationship_weight_property: 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) → DijkstraMutateResult

Runs the Dijkstra shortest path algorithm for a source node to one or more target nodes and stores the results as new relationships in the graph catalog.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

DijkstraMutateResult

abstract stream(G: Graph, source_node: int, target_nodes: int | list[int], relationship_weight_property: 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) → DataFrame

Runs the Dijkstra shortest path algorithm for a source node to one or more target nodes and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, source_node: int, target_nodes: int | list[int], write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → DijkstraWriteResult

Runs the Dijkstra shortest path algorithm for a source node to one or more target nodes and writes the results back to the database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (int | list[int]) – A single target node or a list of target nodes for the shortest path computation.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship(s).

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship(s).

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

  • 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.Returns

  • -------

  • DijkstraWriteResult – Object containing metadata from the execution.

Return type:

DijkstraWriteResult

class graphdatascience.procedure_surface.api.pathfinding.SourceTargetYensEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_node: int, k: int, relationship_weight_property: str | None = None, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Yen’s K shortest paths algorithm.

The Yen’s algorithm computes the K shortest paths from a source node to a target node.

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

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • k (int) – Number of shortest paths to find.

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

  • 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.

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

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

Returns:

Object containing the estimated memory requirements.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, source_node: int, target_node: int, k: int, relationship_weight_property: 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) → YensMutateResult

Runs the Yen’s K shortest paths algorithm and stores the results as new relationships in the graph catalog.

The Yen’s algorithm computes the K shortest paths from a source node to a target node.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • k (int) – Number of shortest paths to find.

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

  • 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.

Returns:

Object containing metadata from the execution.

Return type:

YensMutateResult

abstract stream(G: Graph, source_node: int, target_node: int, k: int, relationship_weight_property: 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) → DataFrame

Runs the Yen’s K shortest paths algorithm and returns the result as a DataFrame.

The Yen’s algorithm computes the K shortest paths from a source node to a target node.

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

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • k (int) – Number of shortest paths to find.

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

  • 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.

Returns:

The shortest path results as a DataFrame with columns for sourceNode, targetNode, totalCost, nodeIds, costs, index.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, source_node: int, target_node: int, k: int, write_node_ids: bool = False, write_costs: bool = False, relationship_weight_property: 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) → YensWriteResult

Runs the Yen’s K shortest paths algorithm and writes the results back to the database.

The Yen’s algorithm computes the K shortest paths from a source node to a target node.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

  • source_node (int) – Node id to use as the starting point.

  • target_node (int) – The target node for the shortest path computation.

  • k (int) – Number of shortest paths to find.

  • write_node_ids (bool) – Whether to write node IDs of the shortest path onto the relationship.

  • write_costs (bool) – Whether to write costs of the shortest path onto the relationship.

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

  • 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.Returns

  • -------

  • YensWriteResult – Object containing metadata from the execution.

Return type:

YensWriteResult

class graphdatascience.procedure_surface.api.pathfinding.SpanningTreeEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Spanning tree algorithm.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.

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

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

Returns:

Memory estimation results including required bytes and percentages.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, mutate_property: str, source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', 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) → SpanningTreeMutateResult

Runs the Spanning tree algorithm and adds the result as new relationships to the in-memory graph.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.

Returns:

Result containing statistics and timing information.

Return type:

SpanningTreeMutateResult

abstract stats(G: Graph, source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', 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) → SpanningTreeStatsResult

Runs the Spanning tree algorithm in stats mode, returning statistics without modifying the graph.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.

Returns:

Statistics about the computed Spanning tree.

Return type:

SpanningTreeStatsResult

abstract stream(G: Graph, source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', 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) → DataFrame

Runs the Spanning tree algorithm and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.

Returns:

A DataFrame containing the edges in the computed Spanning tree.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, write_property: str, source_node: int, relationship_weight_property: str | None = None, objective: str = 'minimum', 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) → SpanningTreeWriteResult

Runs the Spanning tree algorithm and writes the result back to the Neo4j database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

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

  • source_node (int) – Node id to use as the starting point.

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

  • objective (str) – The objective function to optimize. Either “minimum” or “maximum”.

  • 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.Returns

  • -------

  • SpanningTreeWriteResult – Result containing statistics and timing information.

Return type:

SpanningTreeWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field mutate_millis: int
field pre_processing_millis: int
field relationships_written: int
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field pre_processing_millis: int
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field pre_processing_millis: int
field relationships_written: int
field total_weight: float
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.SteinerTreeEndpoints
abstract estimate(G: Graph | dict[str, Any], source_node: int, target_nodes: list[int], relationship_weight_property: str | None = None, delta: float = 2.0, apply_rerouting: bool = False, relationship_types: list[str] = ['*'], node_labels: list[str] = ['*'], sudo: bool = False, username: str | None = None, concurrency: int | None = None) → EstimationResult

Estimates the memory requirements for running the Steiner tree algorithm.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (list[int]) – List of target node IDs.

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

  • delta (float) – The delta parameter for the shortest path computation.

  • apply_rerouting (bool) – Whether to apply rerouting optimization.

  • 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.

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

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

Returns:

Memory estimation results including required bytes and percentages.

Return type:

EstimationResult

abstract mutate(G: Graph, mutate_relationship_type: str, mutate_property: str, source_node: int, target_nodes: list[int], relationship_weight_property: str | None = None, delta: float = 2.0, apply_rerouting: bool = False, 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) → SteinerTreeMutateResult

Runs the Steiner tree algorithm and adds the result as new relationships to the in-memory graph.

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

  • mutate_relationship_type (str) – Name of the relationship type to store the results in.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (list[int]) – List of target node IDs.

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

  • delta (float) – The delta parameter for the shortest path computation used internally.

  • apply_rerouting (bool) – Whether to apply rerouting optimization to improve the tree.

  • 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.

Returns:

Result containing statistics and timing information.

Return type:

SteinerTreeMutateResult

abstract stats(G: Graph, source_node: int, target_nodes: list[int], relationship_weight_property: str | None = None, delta: float = 2.0, apply_rerouting: bool = False, 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) → SteinerTreeStatsResult

Runs the Steiner tree algorithm in stats mode, returning statistics without modifying the graph.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (list[int]) – List of target node IDs.

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

  • delta (float) – The delta parameter for the shortest path computation used internally.

  • apply_rerouting (bool) – Whether to apply rerouting optimization to improve the tree.

  • 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.

Returns:

Statistics about the computed Steiner tree.

Return type:

SteinerTreeStatsResult

abstract stream(G: Graph, source_node: int, target_nodes: list[int], relationship_weight_property: str | None = None, delta: float = 2.0, apply_rerouting: bool = False, 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) → DataFrame

Runs the Steiner tree algorithm and returns the result as a DataFrame.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (list[int]) – List of target node IDs.

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

  • delta (float) – The delta parameter for the shortest path computation used internally.

  • apply_rerouting (bool) – Whether to apply rerouting optimization to improve the tree.

  • 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.

Returns:

A DataFrame containing the edges in the computed Steiner tree.

Return type:

pandas.DataFrame

abstract write(G: Graph, write_relationship_type: str, write_property: str, source_node: int, target_nodes: list[int], relationship_weight_property: str | None = None, delta: float = 2.0, apply_rerouting: bool = False, 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) → SteinerTreeWriteResult

Runs the Steiner tree algorithm and writes the result back to the Neo4j database.

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

  • write_relationship_type (str) – Name of the relationship type to store the results in.

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

  • source_node (int) – Node id to use as the starting point.

  • target_nodes (list[int]) – List of target node IDs.

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

  • delta (float) – The delta parameter for the shortest path computation used internally.

  • apply_rerouting (bool) – Whether to apply rerouting optimization to improve the tree.

  • 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.Returns

  • -------

  • SteinerTreeWriteResult – Result containing statistics and timing information.

Return type:

SteinerTreeWriteResult

pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field effective_target_nodes_count: int
field mutate_millis: int
field pre_processing_millis: int
field relationships_written: int
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeStatsResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field effective_target_nodes_count: int
field pre_processing_millis: int
field total_weight: float
pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field effective_node_count: int
field effective_target_nodes_count: int
field pre_processing_millis: int
field relationships_written: int
field total_weight: float
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.TopologicalSortEndpoints
abstract stream(G: Graph, *, compute_max_distance_from_source: bool = False, 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) → DataFrame

Computes the topological sorting of nodes in the Graph and returns the result as a DataFrame.

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

  • compute_max_distance_from_source (bool) – If enabled, the maximum distance from the source node.

  • 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.

Returns:

The topological sort results as a DataFrame with columns for nodeId and maxDistanceFromSource.

Return type:

pandas.DataFrame

pydantic model graphdatascience.procedure_surface.api.pathfinding.YensMutateResult
field compute_millis: int
field configuration: dict[str, Any]
field mutate_millis: int
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
pydantic model graphdatascience.procedure_surface.api.pathfinding.YensWriteResult
field compute_millis: int
field configuration: dict[str, Any]
field post_processing_millis: int
field pre_processing_millis: int
field relationships_written: int
field write_millis: int
class graphdatascience.procedure_surface.api.pathfinding.source_target_dijkstra_endpoints.DijkstraWriteResult
__init__(**data: Any) → None

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

Return type:

None

__new__(**kwargs)
class graphdatascience.procedure_surface.api.pathfinding.source_target_dijkstra_endpoints.DijkstraMutateResult
__init__(**data: Any) → None

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

Return type:

None

__new__(**kwargs)