Pathfinding Algorithms¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.AStarMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.AStarWriteResult¶
- 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: GraphV2 | 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 (GraphV2 | 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:
- abstract stream(G: GraphV2, *, 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 (GraphV2) – 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:
DataFrame
- class graphdatascience.procedure_surface.api.pathfinding.BFSEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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], default=[]) – 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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], default=[]) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
target_nodes (int | list[int], default=[]) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
target_nodes (int | list[int], default=[]) – 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:
DataFrame
- pydantic model graphdatascience.procedure_surface.api.pathfinding.BFSMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.BFSStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.BellmanFordWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.DFSEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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], default=[]) – 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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], default=[]) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
target_nodes (int | list[int], default=[]) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
target_nodes (int | list[int], default=[]) – 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:
DataFrame
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DFSMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DFSStatsResult¶
- 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.
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DeltaSteppingWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.DijkstraEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs along the path.
write_costs (bool, default=False) – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraStreamResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.DijkstraWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.KSpanningTreeEndpoints¶
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default="minimum") – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.KSpanningTreeWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.LongestPathEndpoints¶
- abstract stream(G: GraphV2, *, 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 (GraphV2) – 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:
DataFrame
- class graphdatascience.procedure_surface.api.pathfinding.MaxFlowEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | dict[str, Any]) – Graph object to use or a dictionary representing the graph dimensions.
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:
- abstract property min_cost: MaxFlowMinCostEndpoints¶
Container for Min-Cost Max Flow algorithm endpoints.
- abstract mutate(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
- abstract stats(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
- abstract stream(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
- class graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostEndpoints¶
- abstract estimate(G: GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
- abstract stats(G: GraphV2, 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 (GraphV2) – Graph object to use
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:
- abstract stream(G: GraphV2, 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:
DataFrame
- Parameters:
- abstract write(G: GraphV2, 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:
- Parameters:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMinCostWriteResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.MaxFlowWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.PrizeSteinerTreeWriteResult¶
- 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: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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, default=False) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs of the shortest path onto the relationship.
write_costs (bool, default=False) – Whether to write costs of the shortest path onto the relationship.
write_negative_cycles (bool, default=False) – 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:
- class graphdatascience.procedure_surface.api.pathfinding.SingleSourceDeltaEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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, default=2.0) – 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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, default=2.0) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
delta (float, default=2.0) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – Graph object to use
source_node (int) – Node id to use as the starting point.
delta (float, default=2.0) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=2.0) – The bucket width for grouping nodes by tentative distance.
write_node_ids (bool, default=False) – Whether to write node IDs of the shortest path onto the relationship.
write_costs (bool, default=False) – 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:
- class graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs of the shortest path onto the relationship.
write_costs (bool, default=False) – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SingleSourceDijkstraWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.SourceTargetAStarEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs of the shortest path onto the relationship.
write_costs (bool, default=False) – 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:
- class graphdatascience.procedure_surface.api.pathfinding.SourceTargetDijkstraEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs of the shortest path onto the relationship(s).
write_costs (bool, default=False) – 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: GraphV2 | 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 (GraphV2 | 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default=False) – Whether to write node IDs of the shortest path onto the relationship.
write_costs (bool, default=False) – 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:
- class graphdatascience.procedure_surface.api.pathfinding.SpanningTreeEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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, default="minimum") – 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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, default="minimum") – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – 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, default="minimum") – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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, default="minimum") – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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, default="minimum") – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SpanningTreeWriteResult¶
- class graphdatascience.procedure_surface.api.pathfinding.SteinerTreeEndpoints¶
- abstract estimate(G: GraphV2 | 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 (GraphV2 | 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.
delta (float, default=2.0) – The delta parameter for the shortest path computation.
apply_rerouting (bool, default=False) – 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:
- abstract mutate(G: GraphV2, 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 (GraphV2) – 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.
delta (float, default=2.0) – The delta parameter for the shortest path computation used internally.
apply_rerouting (bool, default=False) – 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:
- abstract stats(G: GraphV2, 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 (GraphV2) – 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.
delta (float, default=2.0) – The delta parameter for the shortest path computation used internally.
apply_rerouting (bool, default=False) – 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:
- abstract stream(G: GraphV2, 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 (GraphV2) – 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.
delta (float, default=2.0) – The delta parameter for the shortest path computation used internally.
apply_rerouting (bool, default=False) – 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:
DataFrame
- abstract write(G: GraphV2, 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 (GraphV2) – 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.
delta (float, default=2.0) – The delta parameter for the shortest path computation used internally.
apply_rerouting (bool, default=False) – 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:
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeMutateResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeStatsResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.SteinerTreeWriteResult¶
- pydantic model graphdatascience.procedure_surface.api.pathfinding.YensMutateResult¶