diff --git a/graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py b/graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py new file mode 100644 index 000000000..e47945067 --- /dev/null +++ b/graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py @@ -0,0 +1,187 @@ +from __future__ import annotations + +from abc import ABC, abstractmethod +from types import TracebackType +from typing import List, NamedTuple, Optional, Type + +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 + + +class GraphSamplingEndpoints(ABC): + """ + Abstract base class defining the API for graph sampling operations. + """ + + @abstractmethod + def rwr( + self, + G: GraphV2, + graph_name: str, + start_nodes: Optional[List[int]] = None, + restart_probability: Optional[float] = None, + sampling_ratio: Optional[float] = None, + node_label_stratification: Optional[bool] = None, + relationship_weight_property: Optional[str] = None, + relationship_types: Optional[List[str]] = None, + node_labels: Optional[List[str]] = None, + sudo: Optional[bool] = None, + log_progress: Optional[bool] = None, + username: Optional[str] = None, + concurrency: Optional[int] = None, + job_id: Optional[str] = None, + ) -> GraphWithSamplingResult: + """ + Random walk with restarts (RWR) samples the graph by taking random walks from a set of start nodes. + + On each step of a random walk, there is a probability that the walk stops, and a new walk from one of the start + nodes starts instead (i.e. the walk restarts). Each node visited on these walks will be part of the sampled + subgraph. The resulting subgraph is stored as a new graph in the Graph Catalog. + + Parameters + ---------- + G : GraphV2 + The input graph to be sampled. + graph_name : str + The name of the new graph that is stored in the graph catalog. + start_nodes : list of int, optional + IDs of the initial set of nodes in the original graph from which the sampling random walks will start. + By default, a single node is chosen uniformly at random. + restart_probability : float, optional + The probability that a sampling random walk restarts from one of the start nodes. + Default is 0.1. + sampling_ratio : float, optional + The fraction of nodes in the original graph to be sampled. + Default is 0.15. + node_label_stratification : bool, optional + If true, preserves the node label distribution of the original graph. + Default is False. + relationship_weight_property : str, optional + Name of the relationship property to use as weights. If unspecified, the algorithm runs unweighted. + relationship_types : list of str, optional + Filter the named graph using the given relationship types. Relationships with any of the given types will be + included. + node_labels : list of str, optional + Filter the named graph using the given node labels. Nodes with any of the given labels will be included. + sudo : bool, optional + Bypass heap control. Use with caution. + Default is False. + log_progress : bool, optional + Turn `on/off` percentage logging while running procedure. + Default is True. + username : str, optional + Use Administrator access to run an algorithm on a graph owned by another user. + Default is None. + concurrency : int, optional + The number of concurrent threads used for running the algorithm. + Default is 4. + job_id : str, optional + An ID that can be provided to more easily track the algorithm’s progress. + By default, a random job id is generated. + + Returns + ------- + GraphWithSamplingResult + Tuple of the graph object and the result of the Random Walk with Restart (RWR), including the dimensions of the sampled graph. + """ + pass + + @abstractmethod + def cnarw( + self, + G: GraphV2, + graph_name: str, + start_nodes: Optional[List[int]] = None, + restart_probability: Optional[float] = None, + sampling_ratio: Optional[float] = None, + node_label_stratification: Optional[bool] = None, + relationship_weight_property: Optional[str] = None, + relationship_types: Optional[List[str]] = None, + node_labels: Optional[List[str]] = None, + sudo: Optional[bool] = None, + log_progress: Optional[bool] = None, + username: Optional[str] = None, + concurrency: Optional[int] = None, + job_id: Optional[str] = None, + ) -> GraphWithSamplingResult: + """ + Common Neighbour Aware Random Walk (CNARW) samples the graph by taking random walks from a set of start nodes + + CNARW is a graph sampling technique that involves optimizing the selection of the next-hop node. It takes into + account the number of common neighbours between the current node and the next-hop candidates. On each step of a + random walk, there is a probability that the walk stops, and a new walk from one of the start nodes starts + instead (i.e. the walk restarts). Each node visited on these walks will be part of the sampled subgraph. The + resulting subgraph is stored as a new graph in the Graph Catalog. + + Parameters + ---------- + G : GraphV2 + The input graph to be sampled. + graph_name : str + The name of the new graph that is stored in the graph catalog. + start_nodes : list of int, optional + IDs of the initial set of nodes in the original graph from which the sampling random walks will start. + By default, a single node is chosen uniformly at random. + restart_probability : float, optional + The probability that a sampling random walk restarts from one of the start nodes. + Default is 0.1. + sampling_ratio : float, optional + The fraction of nodes in the original graph to be sampled. + Default is 0.15. + node_label_stratification : bool, optional + If true, preserves the node label distribution of the original graph. + Default is False. + relationship_weight_property : str, optional + Name of the relationship property to use as weights. If unspecified, the algorithm runs unweighted. + relationship_types : list of str, optional + Filter the named graph using the given relationship types. Relationships with any of the given types will be + included. + node_labels : list of str, optional + Filter the named graph using the given node labels. Nodes with any of the given labels will be included. + sudo : bool, optional + Bypass heap control. Use with caution. + Default is False. + log_progress : bool, optional + Turn `on/off` percentage logging while running procedure. + Default is True. + username : str, optional + Use Administrator access to run an algorithm on a graph owned by another user. + Default is None. + concurrency : int, optional + The number of concurrent threads used for running the algorithm. + Default is 4. + job_id : str, optional + An ID that can be provided to more easily track the algorithm’s progress. + By default, a random job id is generated. + + Returns + ------- + GraphSamplingResult + Tuple of the graph object and the result of the Common Neighbour Aware Random Walk (CNARW), including the dimensions of the sampled graph. + """ + pass + + +class GraphSamplingResult(BaseResult): + graph_name: str + from_graph_name: str + node_count: int + relationship_count: int + start_node_count: int + project_millis: int + + +class GraphWithSamplingResult(NamedTuple): + graph: GraphV2 + result: GraphSamplingResult + + def __enter__(self) -> GraphV2: + return self.graph + + def __exit__( + self, + exception_type: Optional[Type[BaseException]], + exception_value: Optional[BaseException], + traceback: Optional[TracebackType], + ) -> None: + self.graph.drop() diff --git a/graphdatascience/procedure_surface/api/catalog_endpoints.py b/graphdatascience/procedure_surface/api/catalog_endpoints.py index 859d495fc..fb5c66705 100644 --- a/graphdatascience/procedure_surface/api/catalog_endpoints.py +++ b/graphdatascience/procedure_surface/api/catalog_endpoints.py @@ -10,7 +10,7 @@ from graphdatascience.procedure_surface.api.catalog.node_label_endpoints import NodeLabelEndpoints from graphdatascience.procedure_surface.api.catalog.node_properties_endpoints import NodePropertiesEndpoints from graphdatascience.procedure_surface.api.catalog.relationships_endpoints import RelationshipsEndpoints -from graphdatascience.procedure_surface.api.graph_sampling_endpoints import GraphSamplingEndpoints +from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import GraphSamplingEndpoints class CatalogEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/centrality/__init__.py b/graphdatascience/procedure_surface/api/centrality/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/graphdatascience/procedure_surface/api/articlerank_endpoints.py b/graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py similarity index 72% rename from graphdatascience/procedure_surface/api/articlerank_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py index d17092362..3fcd0d006 100644 --- a/graphdatascience/procedure_surface/api/articlerank_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py @@ -8,13 +8,10 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class ArticleRankEndpoints(ABC): - """ - Abstract base class defining the API for the ArticleRank algorithm. - """ @abstractmethod def mutate( @@ -36,40 +33,44 @@ def mutate( source_nodes: Optional[Any] = None, ) -> ArticleRankMutateResult: """ - Executes the ArticleRank algorithm and writes the results back to the graph as a node property. + Runs the Article Rank algorithm and stores the results in the graph catalog as a new node property. + + ArticleRank is a variant of the Page Rank algorithm, which measures the transitive influence of nodes. + Page Rank follows the assumption that relationships originating from low-degree nodes have a higher influence than relationships from high-degree nodes. + Article Rank lowers the influence of low-degree nodes by lowering the scores being sent to their neighbors in each iteration. Parameters ---------- G : GraphV2 The graph to run the algorithm on mutate_property : str - The property name to store the ArticleRank score for each node + Name of the node property to store the results in. damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized ArticleRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. Returns ------- @@ -96,38 +97,42 @@ def stats( source_nodes: Optional[Any] = None, ) -> ArticleRankStatsResult: """ - Executes the ArticleRank algorithm and returns result statistics without writing the result to Neo4j. + Runs the Article Rank algorithm and returns result statistics without storing the results. + + ArticleRank is a variant of the Page Rank algorithm, which measures the transitive influence of nodes. + Page Rank follows the assumption that relationships originating from low-degree nodes have a higher influence than relationships from high-degree nodes. + Article Rank lowers the influence of low-degree nodes by lowering the scores being sent to their neighbors in each iteration. Parameters ---------- G : GraphV2 The graph to run the algorithm on damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized ArticleRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. Returns ------- @@ -214,7 +219,11 @@ def write( write_concurrency: Optional[int] = None, ) -> ArticleRankWriteResult: """ - Executes the ArticleRank algorithm and writes the results to Neo4j. + Runs the Article Rank algorithm and stores the result in the Neo4j database as a new node property. + + ArticleRank is a variant of the Page Rank algorithm, which measures the transitive influence of nodes. + Page Rank follows the assumption that relationships originating from low-degree nodes have a higher influence than relationships from high-degree nodes. + Article Rank lowers the influence of low-degree nodes by lowering the scores being sent to their neighbors in each iteration. Parameters ---------- @@ -223,31 +232,31 @@ def write( write_property : str The property name to write the ArticleRank score for each node damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized ArticleRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. write_concurrency : Optional[int], default=None The number of concurrent threads used for writing diff --git a/graphdatascience/procedure_surface/api/articulationpoints_endpoints.py b/graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py similarity index 87% rename from graphdatascience/procedure_surface/api/articulationpoints_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py index 5d26871c4..3a035379d 100644 --- a/graphdatascience/procedure_surface/api/articulationpoints_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py @@ -6,13 +6,10 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class ArticulationPointsEndpoints(ABC): - """ - Abstract base class defining the API for the Articulation Points algorithm. - """ @abstractmethod def mutate( @@ -28,7 +25,10 @@ def mutate( job_id: Optional[Any] = None, ) -> "ArticulationPointsMutateResult": """ - Executes the ArticulationPoints algorithm and writes the results to the in-memory graph as node properties. + Runs the Articulation Points algorithm and stores the results in the graph catalog as a new node property. + + Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph. + The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph. Parameters ---------- @@ -70,7 +70,10 @@ def stats( job_id: Optional[Any] = None, ) -> "ArticulationPointsStatsResult": """ - Executes the ArticulationPoints algorithm and returns result statistics without writing the result to Neo4j. + Runs the Articulation Points algorithm and returns result statistics without storing the results. + + Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph. + The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph. Parameters ---------- @@ -154,7 +157,10 @@ def write( write_concurrency: Optional[Any] = None, ) -> "ArticulationPointsWriteResult": """ - Executes the ArticulationPoints algorithm and writes the results back to the Neo4j database. + Runs the Articulation Points algorithm and stores the result in the Neo4j database as a new node property. + + Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph. + The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph. Parameters ---------- diff --git a/graphdatascience/procedure_surface/api/betweenness_endpoints.py b/graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py similarity index 71% rename from graphdatascience/procedure_surface/api/betweenness_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py index fa1a53553..8c5f8e1b1 100644 --- a/graphdatascience/procedure_surface/api/betweenness_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py @@ -8,13 +8,10 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class BetweennessEndpoints(ABC): - """ - Abstract base class defining the API for the Betweenness Centrality algorithm. - """ @abstractmethod def mutate( @@ -33,34 +30,39 @@ def mutate( relationship_weight_property: Optional[str] = None, ) -> BetweennessMutateResult: """ - Executes the Betweenness Centrality algorithm and returns result statistics without persisting the results + Runs the Betweenness Centrality algorithm and stores the results in the graph catalog as a new node property. + + Betweenness centrality is a way of detecting the amount of influence a node has over the flow of information in a graph. + It is often used to find nodes that serve as a bridge from one part of a graph to another. + The algorithm calculates shortest paths between all pairs of nodes in a graph. + Each node receives a score, based on the number of shortest paths that pass through the node. Parameters ---------- G : GraphV2 The graph to run the algorithm on mutate_property : str - The property name to store the betweenness centrality score for each node + Name of the node property to store the results in. sampling_size : Optional[int], default=None - The number of nodes to use for sampling. + Number of source nodes to consider for computing centrality scores. sampling_seed : Optional[int], default=None - The seed value for sampling randomization + Seed value for the random number generator that selects source nodes. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights + Name of the property to be used as weights. Returns ------- @@ -84,32 +86,37 @@ def stats( relationship_weight_property: Optional[str] = None, ) -> BetweennessStatsResult: """ - Executes the Betweenness Centrality algorithm and returns result statistics without writing the result to Neo4j. + Runs the Betweenness Centrality algorithm and returns result statistics without storing the results. + + Betweenness centrality is a way of detecting the amount of influence a node has over the flow of information in a graph. + It is often used to find nodes that serve as a bridge from one part of a graph to another. + The algorithm calculates shortest paths between all pairs of nodes in a graph. + Each node receives a score, based on the number of shortest paths that pass through the node. Parameters ---------- G : GraphV2 The graph to run the algorithm on sampling_size : Optional[int], default=None - The number of nodes to use for sampling. + Number of source nodes to consider for computing centrality scores. sampling_seed : Optional[int], default=None - The seed value for sampling randomization + Seed value for the random number generator that selects source nodes. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights + Name of the property to be used as weights. Returns ------- @@ -184,34 +191,39 @@ def write( write_concurrency: Optional[Any] = None, ) -> BetweennessWriteResult: """ - Executes the Betweenness Centrality algorithm and writes the results to the Neo4j database. + Runs the Betweenness Centrality algorithm and stores the result in the Neo4j database as a new node property. + + Betweenness centrality is a way of detecting the amount of influence a node has over the flow of information in a graph. + It is often used to find nodes that serve as a bridge from one part of a graph to another. + The algorithm calculates shortest paths between all pairs of nodes in a graph. + Each node receives a score, based on the number of shortest paths that pass through the node. Parameters ---------- G : GraphV2 The graph to run the algorithm on write_property : str - The property name to store the betweenness centrality score for each node + Name of the node property to store the results in. sampling_size : Optional[int], default=None - The number of nodes to use for sampling. + Number of source nodes to consider for computing centrality scores. sampling_seed : Optional[int], default=None - The seed value for sampling randomization + Seed value for the random number generator that selects source nodes. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights + Name of the property to be used as weights. write_concurrency : Optional[Any], default=None The number of concurrent threads during the write phase diff --git a/graphdatascience/procedure_surface/api/celf_endpoints.py b/graphdatascience/procedure_surface/api/centrality/celf_endpoints.py similarity index 78% rename from graphdatascience/procedure_surface/api/celf_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/celf_endpoints.py index f21b461c6..8f94b5a34 100644 --- a/graphdatascience/procedure_surface/api/celf_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/celf_endpoints.py @@ -7,17 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class CelfEndpoints(ABC): - """ - Abstract base class defining the API for the Cost Effective Lazy Forward (CELF) algorithm. - - The CELF algorithm aims to find k nodes that maximize the expected spread of influence - in the network. - """ @abstractmethod def mutate( @@ -37,7 +31,9 @@ def mutate( job_id: Optional[Any] = None, ) -> CelfMutateResult: """ - Executes the CELF algorithm and writes the results to the in-memory graph as node properties. + Runs the CELF algorithm and stores the results in the graph catalog as a new node property. + + The influence maximization problem asks for a set of k nodes that maximize the expected spread of influence in the network. Parameters ---------- @@ -46,28 +42,27 @@ def mutate( seed_set_size : int The number of nodes to select as the seed set for influence maximization mutate_property : str - The property name to store the influence spread value for each selected node + Name of the node property to store the results in. propagation_probability : Optional[float], default=None - The probability that influence spreads from one node to another. + Probability of a node being activated by an active neighbour node. monte_carlo_simulations : Optional[int], default=None - The number of Monte-Carlo simulations. + Number of Monte-Carlo simulations. random_seed : Optional[Any], default=None Random seed for reproducible results. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. Returns ------- @@ -93,7 +88,9 @@ def stats( job_id: Optional[Any] = None, ) -> CelfStatsResult: """ - Executes the CELF algorithm and returns statistics without writing the result to Neo4j. + Runs the CELF algorithm and returns result statistics without storing the results. + + The influence maximization problem asks for a set of k nodes that maximize the expected spread of influence in the network. Parameters ---------- @@ -102,26 +99,25 @@ def stats( seed_set_size : int The number of nodes to select as the seed set for influence maximization propagation_probability : Optional[float], default=None - The probability that influence spreads from one node to another. + Probability of a node being activated by an active neighbour node. monte_carlo_simulations : Optional[int], default=None - The number of Monte-Carlo simulations. + Number of Monte-Carlo simulations. random_seed : Optional[Any], default=None Random seed for reproducible results. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. Returns ------- @@ -204,7 +200,9 @@ def write( write_concurrency: Optional[Any] = None, ) -> CelfWriteResult: """ - Executes the CELF algorithm and writes the results to the Neo4j database. + Runs the CELF algorithm and stores the result in the Neo4j database as a new node property. + + The influence maximization problem asks for a set of k nodes that maximize the expected spread of influence in the network. Parameters ---------- @@ -213,28 +211,27 @@ def write( seed_set_size : int The number of nodes to select as the seed set for influence maximization write_property : str - The property name to store the influence spread value for each selected node in the database + Name of the node property to store the results in. propagation_probability : Optional[float], default=None - The probability that influence spreads from one node to another. + Probability of a node being activated by an active neighbour node. monte_carlo_simulations : Optional[int], default=None - The number of Monte-Carlo simulations. + Number of Monte-Carlo simulations. random_seed : Optional[Any], default=None Random seed for reproducible results. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. write_concurrency : Optional[Any], default=None The number of concurrent threads used during the write phase. diff --git a/graphdatascience/procedure_surface/api/closeness_endpoints.py b/graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py similarity index 87% rename from graphdatascience/procedure_surface/api/closeness_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py index 886fd6ac6..3a674e1cc 100644 --- a/graphdatascience/procedure_surface/api/closeness_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py @@ -7,18 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class ClosenessEndpoints(ABC): - """ - Abstract base class defining the API for the Closeness Centrality algorithm. - - Closeness centrality measures how close a node is to all other nodes in the network. - It's calculated as the reciprocal of the sum of the shortest path distances from - the node to all other nodes in the graph. - """ @abstractmethod def mutate( @@ -35,7 +28,11 @@ def mutate( job_id: Optional[Any] = None, ) -> ClosenessMutateResult: """ - Executes the Closeness Centrality algorithm and writes the results to the in-memory graph as node properties. + Runs the Closeness Centrality algorithm and stores the results in the graph catalog as a new node property. + + Closeness centrality is a way of detecting nodes that are able to spread information very efficiently through a graph. + The closeness centrality of a node measures its average farness (inverse distance) to all other nodes. + Nodes with a high closeness score have the shortest distances to all other nodes. Parameters ---------- @@ -82,7 +79,11 @@ def stats( job_id: Optional[Any] = None, ) -> ClosenessStatsResult: """ - Executes the Closeness Centrality algorithm and returns statistics without writing the result to Neo4j. + Runs the Closeness Centrality algorithm and returns result statistics without storing the results. + + Closeness centrality is a way of detecting nodes that are able to spread information very efficiently through a graph. + The closeness centrality of a node measures its average farness (inverse distance) to all other nodes. + Nodes with a high closeness score have the shortest distances to all other nodes. Parameters ---------- @@ -175,7 +176,11 @@ def write( write_concurrency: Optional[Any] = None, ) -> ClosenessWriteResult: """ - Executes the Closeness Centrality algorithm and writes the results to the Neo4j database. + Runs the Closeness Centrality algorithm and stores the result in the Neo4j database as a new node property. + + Closeness centrality is a way of detecting nodes that are able to spread information very efficiently through a graph. + The closeness centrality of a node measures its average farness (inverse distance) to all other nodes. + Nodes with a high closeness score have the shortest distances to all other nodes. Parameters ---------- diff --git a/graphdatascience/procedure_surface/api/closeness_harmonic_endpoints.py b/graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py similarity index 85% rename from graphdatascience/procedure_surface/api/closeness_harmonic_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py index e3068d40b..6542cddc0 100644 --- a/graphdatascience/procedure_surface/api/closeness_harmonic_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py @@ -7,18 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class ClosenessHarmonicEndpoints(ABC): - """ - Abstract base class defining the API for the Harmonic Centrality algorithm. - - Harmonic centrality is a variant of closeness centrality that uses the - harmonic mean of shortest path distances. It handles disconnected graphs better - than standard closeness centrality. - """ @abstractmethod def mutate( @@ -34,7 +27,10 @@ def mutate( job_id: Optional[Any] = None, ) -> ClosenessHarmonicMutateResult: """ - Executes the Harmonic Closeness Centrality algorithm and writes the results to the in-memory graph as node properties. + Runs the Harmonic Centrality algorithm and stores the results in the graph catalog as a new node property. + + Harmonic centrality (also known as valued centrality) is a variant of closeness centrality, that was invented to + solve the problem the original formula had when dealing with unconnected graphs. Parameters ---------- @@ -78,7 +74,12 @@ def stats( job_id: Optional[Any] = None, ) -> ClosenessHarmonicStatsResult: """ - Executes the Harmonic Closeness Centrality algorithm and returns statistics without writing the result to Neo4j. + Runs the Harmonic Centrality algorithm and returns result statistics without storing the results. + + Harmonic centrality was proposed by Marchiori and Latora while trying to come up with a sensible notion of "average shortest path". + They suggested a different way of calculating the average distance to that used in the Closeness Centrality algorithm. + Rather than summing the distances of a node to all other nodes, the harmonic centrality algorithm sums the inverse of those distances. + This enables it deal with infinite values. Parameters ---------- @@ -164,7 +165,12 @@ def write( write_concurrency: Optional[Any] = None, ) -> ClosenessHarmonicWriteResult: """ - Executes the Harmonic Closeness Centrality algorithm and writes the results to the Neo4j database. + Runs the Harmonic Centrality algorithm and stores the result in the Neo4j database as a new node property. + + Harmonic centrality was proposed by Marchiori and Latora while trying to come up with a sensible notion of "average shortest path". + They suggested a different way of calculating the average distance to that used in the Closeness Centrality algorithm. + Rather than summing the distances of a node to all other nodes, the harmonic centrality algorithm sums the inverse of those distances. + This enables it deal with infinite values. Parameters ---------- diff --git a/graphdatascience/procedure_surface/api/degree_endpoints.py b/graphdatascience/procedure_surface/api/centrality/degree_endpoints.py similarity index 71% rename from graphdatascience/procedure_surface/api/degree_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/degree_endpoints.py index 8e352f85b..584c3d91f 100644 --- a/graphdatascience/procedure_surface/api/degree_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/degree_endpoints.py @@ -7,18 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class DegreeEndpoints(ABC): - """ - Abstract base class defining the API for the Degree Centrality algorithm. - - Degree centrality measures the number of incoming and outgoing relationships from a node. - It's one of the simplest centrality measures, where a node's importance is determined by - the number of direct connections it has. - """ @abstractmethod def mutate( @@ -36,38 +29,37 @@ def mutate( relationship_weight_property: Optional[str] = None, ) -> DegreeMutateResult: """ - Executes the Degree Centrality algorithm and writes the results to the in-memory graph as node properties. + Runs the Degree Centrality algorithm and stores the results in the graph catalog as a new node property. + + The Degree Centrality algorithm can be used to find popular nodes within a graph. + The degree centrality measures the number of incoming or outgoing (or both) relationships from a node, which can be defined by the orientation of a relationship projection. + It can be applied to either weighted or unweighted graphs. + In the weighted case the algorithm computes the sum of all positive weights of adjacent relationships of a node, for each node in the graph. Parameters ---------- G : GraphV2 The graph to run the algorithm on mutate_property : str - The property name to store the degree centrality score for each node + Name of the node property to store the results in. orientation : Optional[Any], default=None The orientation of relationships to consider. Can be 'NATURAL', 'REVERSE', or 'UNDIRECTED'. - 'NATURAL' (default) respects the direction of relationships as they are stored in the graph. - 'REVERSE' treats each relationship as if it were directed in the opposite direction. - 'UNDIRECTED' treats all relationships as undirected, effectively counting both directions. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights. If specified, - weighted degree centrality is computed where each relationship contributes - its weight to the total degree. + Name of the property to be used as weights. Returns ------- @@ -91,7 +83,12 @@ def stats( relationship_weight_property: Optional[str] = None, ) -> DegreeStatsResult: """ - Executes the Degree Centrality algorithm and returns statistics without writing the result to Neo4j. + Runs the Degree Centrality algorithm and returns result statistics without storing the results. + + The Degree Centrality algorithm can be used to find popular nodes within a graph. + The degree centrality measures the number of incoming or outgoing (or both) relationships from a node, which can be defined by the orientation of a relationship projection. + It can be applied to either weighted or unweighted graphs. + In the weighted case the algorithm computes the sum of all positive weights of adjacent relationships of a node, for each node in the graph. Parameters ---------- @@ -99,28 +96,22 @@ def stats( The graph to run the algorithm on orientation : Optional[Any], default=None The orientation of relationships to consider. Can be 'NATURAL', 'REVERSE', or 'UNDIRECTED'. - 'NATURAL' (default) respects the direction of relationships as they are stored in the graph. - 'REVERSE' treats each relationship as if it were directed in the opposite direction. - 'UNDIRECTED' treats all relationships as undirected, effectively counting both directions. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights. If specified, - weighted degree centrality is computed where each relationship contributes - its weight to the total degree. + Name of the property to be used as weights. Returns ------- @@ -200,7 +191,12 @@ def write( write_concurrency: Optional[Any] = None, ) -> DegreeWriteResult: """ - Executes the Degree Centrality algorithm and writes the results to the Neo4j database. + Runs the Degree Centrality algorithm and stores the result in the Neo4j database as a new node property. + + The Degree Centrality algorithm can be used to find popular nodes within a graph. + The degree centrality measures the number of incoming or outgoing (or both) relationships from a node, which can be defined by the orientation of a relationship projection. + It can be applied to either weighted or unweighted graphs. + In the weighted case the algorithm computes the sum of all positive weights of adjacent relationships of a node, for each node in the graph. Parameters ---------- @@ -210,28 +206,22 @@ def write( The property name to store the degree centrality score for each node in the database orientation : Optional[Any], default=None The orientation of relationships to consider. Can be 'NATURAL', 'REVERSE', or 'UNDIRECTED'. - 'NATURAL' (default) respects the direction of relationships as they are stored in the graph. - 'REVERSE' treats each relationship as if it were directed in the opposite direction. - 'UNDIRECTED' treats all relationships as undirected, effectively counting both directions. relationship_types : Optional[List[str]], default=None - The relationship types used to select relationships for this algorithm run. + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run. + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress of the algorithm execution + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads used for the algorithm execution. + The number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job that can be used for monitoring and cancellation + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains relationship weights. If specified, - weighted degree centrality is computed where each relationship contributes - its weight to the total degree. + Name of the property to be used as weights. write_concurrency : Optional[Any], default=None The number of concurrent threads used during the write phase. diff --git a/graphdatascience/procedure_surface/api/eigenvector_endpoints.py b/graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py similarity index 88% rename from graphdatascience/procedure_surface/api/eigenvector_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py index f81a021ca..d752fb57b 100644 --- a/graphdatascience/procedure_surface/api/eigenvector_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py @@ -7,19 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class EigenvectorEndpoints(ABC): - """ - Abstract base class defining the API for the Eigenvector Centrality algorithm. - - Eigenvector centrality measures the influence of a node in a network based on the - concept that connections to high-scoring nodes contribute more to the score than - equal connections to low-scoring nodes. It's computed as the principal eigenvector - of the adjacency matrix. - """ @abstractmethod def mutate( @@ -40,7 +32,12 @@ def mutate( job_id: Optional[Any] = None, ) -> EigenvectorMutateResult: """ - Executes the Eigenvector Centrality algorithm and writes the results to the in-memory graph as node properties. + Runs the Eigenvector Centrality algorithm and stores the results in the graph catalog as a new node property. + + Eigenvector Centrality is an algorithm that measures the transitive influence of nodes. + Relationships originating from high-scoring nodes contribute more to the score of a node than connections from low-scoring nodes. + A high eigenvector score means that a node is connected to many nodes who themselves have high scores. + The algorithm computes the eigenvector associated with the largest absolute eigenvalue. Parameters ---------- @@ -99,7 +96,12 @@ def stats( job_id: Optional[Any] = None, ) -> EigenvectorStatsResult: """ - Executes the Eigenvector Centrality algorithm and returns statistics without writing the result to Neo4j. + Runs the Eigenvector Centrality algorithm and returns result statistics without storing the results. + + Eigenvector Centrality is an algorithm that measures the transitive influence of nodes. + Relationships originating from high-scoring nodes contribute more to the score of a node than connections from low-scoring nodes. + A high eigenvector score means that a node is connected to many nodes who themselves have high scores. + The algorithm computes the eigenvector associated with the largest absolute eigenvalue. Parameters ---------- @@ -215,7 +217,12 @@ def write( write_concurrency: Optional[Any] = None, ) -> EigenvectorWriteResult: """ - Executes the Eigenvector Centrality algorithm and writes the results to the Neo4j database. + Runs the Eigenvector Centrality algorithm and stores the result in the Neo4j database as a new node property. + + Eigenvector Centrality is an algorithm that measures the transitive influence of nodes. + Relationships originating from high-scoring nodes contribute more to the score of a node than connections from low-scoring nodes. + A high eigenvector score means that a node is connected to many nodes who themselves have high scores. + The algorithm computes the eigenvector associated with the largest absolute eigenvalue. Parameters ---------- diff --git a/graphdatascience/procedure_surface/api/pagerank_endpoints.py b/graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py similarity index 73% rename from graphdatascience/procedure_surface/api/pagerank_endpoints.py rename to graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py index 95551b8fc..3ce353ce8 100644 --- a/graphdatascience/procedure_surface/api/pagerank_endpoints.py +++ b/graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py @@ -8,13 +8,10 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class PageRankEndpoints(ABC): - """ - Abstract base class defining the API for the PageRank algorithm. - """ @abstractmethod def mutate( @@ -36,40 +33,43 @@ def mutate( source_nodes: Optional[Any] = None, ) -> PageRankMutateResult: """ - Executes the PageRank algorithm and writes the results to the in-memory graph as node properties. + Runs the PageRank algorithm and stores the results in the graph catalog as a new node property. + + The PageRank algorithm measures the importance of each node within the graph, based on the number of incoming relationships and the importance of the corresponding source nodes. + The underlying assumption roughly speaking is that a page is only as important as the pages that link to it. Parameters ---------- G : GraphV2 The graph to run the algorithm on mutate_property : str - The property name to store the PageRank score for each node + Name of the node property to store the results in. damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized PageRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. Returns ------- @@ -97,38 +97,41 @@ def stats( source_nodes: Optional[Any] = None, ) -> PageRankStatsResult: """ - Executes the PageRank algorithm and returns statistics. + Runs the PageRank algorithm and returns result statistics without storing the results. + + The PageRank algorithm measures the importance of each node within the graph, based on the number of incoming relationships and the importance of the corresponding source nodes. + The underlying assumption roughly speaking is that a page is only as important as the pages that link to it. Parameters ---------- G : GraphV2 The graph to run the algorithm on damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized PageRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. Returns ------- @@ -217,40 +220,43 @@ def write( write_concurrency: Optional[int] = None, ) -> PageRankWriteResult: """ - Executes the PageRank algorithm and writes the results back to the database. + Runs the PageRank algorithm and stores the result in the Neo4j database as a new node property. + + The PageRank algorithm measures the importance of each node within the graph, based on the number of incoming relationships and the importance of the corresponding source nodes. + The underlying assumption roughly speaking is that a page is only as important as the pages that link to it. Parameters ---------- G : GraphV2 The graph to run the algorithm on write_property : str - The property name to write the PageRank score for each node + Name of the node property to store the results in. damping_factor : Optional[float], default=None - The damping factor controls the probability of a random jump to a random node + Probability of a jump to a random node. tolerance : Optional[float], default=None - Minimum change in scores between iterations + Minimum change in scores between iterations. max_iterations : Optional[int], default=None - The maximum number of iterations to run + Maximum number of iterations to run. scaler : Optional[Any], default=None - Configuration for scaling the scores + Name of the scaler applied on the resulting scores. relationship_types : Optional[List[str]], default=None - The relationships types used to select relationships for this algorithm run + Filter the graph using the given relationship types. Relationships with any of the given types will be included. node_labels : Optional[List[str]], default=None - The node labels used to select nodes for this algorithm run + Filter the graph using the given node labels. Nodes with any of the given labels will be included. sudo : Optional[bool], default=None - Override memory estimation limits + Disable the memory guard. log_progress : Optional[bool], default=None - Whether to log progress + Display progress logging. username : Optional[str], default=None The username to attribute the procedure run to concurrency : Optional[Any], default=None - The number of concurrent threads + Number of threads to use for running the algorithm. job_id : Optional[Any], default=None - An identifier for the job + Identifier for the job. relationship_weight_property : Optional[str], default=None - The property name that contains weight + Name of the property to be used as weights. source_nodes : Optional[Any], default=None - The source nodes for personalized PageRank + List of node ids to use as starting points. Use a list of list pairs to associate each node with a bias > 0. write_concurrency : Optional[int], default=None The number of concurrent threads used for writing diff --git a/graphdatascience/procedure_surface/api/community/__init__.py b/graphdatascience/procedure_surface/api/community/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/graphdatascience/procedure_surface/api/k1coloring_endpoints.py b/graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py similarity index 98% rename from graphdatascience/procedure_surface/api/k1coloring_endpoints.py rename to graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py index b5b53875c..1aeb42b17 100644 --- a/graphdatascience/procedure_surface/api/k1coloring_endpoints.py +++ b/graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py @@ -7,8 +7,8 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class K1ColoringEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/kcore_endpoints.py b/graphdatascience/procedure_surface/api/community/kcore_endpoints.py similarity index 98% rename from graphdatascience/procedure_surface/api/kcore_endpoints.py rename to graphdatascience/procedure_surface/api/community/kcore_endpoints.py index 92968a2fa..d0466e660 100644 --- a/graphdatascience/procedure_surface/api/kcore_endpoints.py +++ b/graphdatascience/procedure_surface/api/community/kcore_endpoints.py @@ -7,8 +7,8 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class KCoreEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/louvain_endpoints.py b/graphdatascience/procedure_surface/api/community/louvain_endpoints.py similarity index 98% rename from graphdatascience/procedure_surface/api/louvain_endpoints.py rename to graphdatascience/procedure_surface/api/community/louvain_endpoints.py index 7ed68fea7..2664de639 100644 --- a/graphdatascience/procedure_surface/api/louvain_endpoints.py +++ b/graphdatascience/procedure_surface/api/community/louvain_endpoints.py @@ -7,8 +7,8 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class LouvainEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/scc_endpoints.py b/graphdatascience/procedure_surface/api/community/scc_endpoints.py similarity index 98% rename from graphdatascience/procedure_surface/api/scc_endpoints.py rename to graphdatascience/procedure_surface/api/community/scc_endpoints.py index 28bd47715..2366d7ea6 100644 --- a/graphdatascience/procedure_surface/api/scc_endpoints.py +++ b/graphdatascience/procedure_surface/api/community/scc_endpoints.py @@ -7,8 +7,8 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class SccEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/wcc_endpoints.py b/graphdatascience/procedure_surface/api/community/wcc_endpoints.py similarity index 98% rename from graphdatascience/procedure_surface/api/wcc_endpoints.py rename to graphdatascience/procedure_surface/api/community/wcc_endpoints.py index 0843f2501..a7013d385 100644 --- a/graphdatascience/procedure_surface/api/wcc_endpoints.py +++ b/graphdatascience/procedure_surface/api/community/wcc_endpoints.py @@ -7,8 +7,8 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .base_result import BaseResult -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.base_result import BaseResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class WccEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/graph_sampling_endpoints.py b/graphdatascience/procedure_surface/api/graph_sampling_endpoints.py deleted file mode 100644 index 337b659ea..000000000 --- a/graphdatascience/procedure_surface/api/graph_sampling_endpoints.py +++ /dev/null @@ -1,181 +0,0 @@ -from __future__ import annotations - -from abc import ABC, abstractmethod -from types import TracebackType -from typing import List, NamedTuple, Optional, Type - -from graphdatascience.procedure_surface.api.base_result import BaseResult -from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 - - -class GraphSamplingEndpoints(ABC): - """ - Abstract base class defining the API for graph sampling algorithms algorithm. - """ - - @abstractmethod - def rwr( - self, - G: GraphV2, - graph_name: str, - start_nodes: Optional[List[int]] = None, - restart_probability: Optional[float] = None, - sampling_ratio: Optional[float] = None, - node_label_stratification: Optional[bool] = None, - relationship_weight_property: Optional[str] = None, - relationship_types: Optional[List[str]] = None, - node_labels: Optional[List[str]] = None, - sudo: Optional[bool] = None, - log_progress: Optional[bool] = None, - username: Optional[str] = None, - concurrency: Optional[int] = None, - job_id: Optional[str] = None, - ) -> GraphWithSamplingResult: - """ - Computes a set of Random Walks with Restart (RWR) for the given graph and stores the result as a new graph in the catalog. - - This method performs a random walk, beginning from a set of nodes (if provided), - where at each step there is a probability to restart back at the original nodes. - The result is turned into a new graph induced by the random walks and stored in the catalog. - - Parameters - ---------- - G : GraphV2 - The input graph on which the Random Walk with Restart (RWR) will be - performed. - graph_name : str - The name of the new graph in the catalog. - start_nodes : list of int, optional - A list of node IDs to start the random walk from. If not provided, all - nodes are used as potential starting points. - restart_probability : float, optional - The probability of restarting back to the original node at each step. - Should be a value between 0 and 1. If not specified, a default value is used. - sampling_ratio : float, optional - The ratio of nodes to sample during the computation. This value should - be between 0 and 1. If not specified, no sampling is performed. - node_label_stratification : bool, optional - If True, the algorithm tries to preserve the label distribution of the original graph in the sampled graph. - relationship_weight_property : str, optional - The name of the property on relationships to use as weights during - the random walk. If not specified, the relationships are treated as - unweighted. - relationship_types : list of str, optional - The relationship types used to select relationships for this algorithm run. - node_labels : list of str, optional - The node labels used to select nodes for this algorithm run. - sudo : bool, optional - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. - log_progress : bool, optional - If True, logs the progress of the computation. - username : str, optional - The username to attribute the procedure run to - concurrency : int, optional - The number of concurrent threads used for the algorithm execution. - job_id : str, optional - An identifier for the job that can be used for monitoring and cancellation - - Returns - ------- - GraphWithSamplingResult - Tuple of the graph object and the result of the Random Walk with Restart (RWR), including the sampled - nodes and their scores. - """ - pass - - @abstractmethod - def cnarw( - self, - G: GraphV2, - graph_name: str, - start_nodes: Optional[List[int]] = None, - restart_probability: Optional[float] = None, - sampling_ratio: Optional[float] = None, - node_label_stratification: Optional[bool] = None, - relationship_weight_property: Optional[str] = None, - relationship_types: Optional[List[str]] = None, - node_labels: Optional[List[str]] = None, - sudo: Optional[bool] = None, - log_progress: Optional[bool] = None, - username: Optional[str] = None, - concurrency: Optional[int] = None, - job_id: Optional[str] = None, - ) -> GraphWithSamplingResult: - """ - Computes a set of Random Walks with Restart (RWR) for the given graph and stores the result as a new graph in the catalog. - - This method performs a random walk, beginning from a set of nodes (if provided), - where at each step there is a probability to restart back at the original nodes. - The result is turned into a new graph induced by the random walks and stored in the catalog. - - Parameters - ---------- - G : GraphV2 - The input graph on which the Random Walk with Restart (RWR) will be - performed. - graph_name : str - The name of the new graph in the catalog. - start_nodes : list of int, optional - A list of node IDs to start the random walk from. If not provided, all - nodes are used as potential starting points. - restart_probability : float, optional - The probability of restarting back to the original node at each step. - Should be a value between 0 and 1. If not specified, a default value is used. - sampling_ratio : float, optional - The ratio of nodes to sample during the computation. This value should - be between 0 and 1. If not specified, no sampling is performed. - node_label_stratification : bool, optional - If True, the algorithm tries to preserve the label distribution of the original graph in the sampled graph. - relationship_weight_property : str, optional - The name of the property on relationships to use as weights during - the random walk. If not specified, the relationships are treated as - unweighted. - relationship_types : list of str, optional - The relationship types used to select relationships for this algorithm run. - node_labels : list of str, optional - The node labels used to select nodes for this algorithm run. - sudo : bool, optional - Override memory estimation limits. Use with caution as this can lead to - memory issues if the estimation is significantly wrong. - log_progress : bool, optional - If True, logs the progress of the computation. - username : str, optional - The username to attribute the procedure run to - concurrency : int, optional - The number of concurrent threads used for the algorithm execution. - job_id : str, optional - An identifier for the job that can be used for monitoring and cancellation - - Returns - ------- - GraphSamplingResult - Tuple of the graph object and the result of the Random Walk with Restart (RWR), including the sampled - nodes and their scores. - """ - pass - - -class GraphSamplingResult(BaseResult): - graph_name: str - from_graph_name: str - node_count: int - relationship_count: int - start_node_count: int - project_millis: int - - -class GraphWithSamplingResult(NamedTuple): - graph: GraphV2 - result: GraphSamplingResult - - def __enter__(self) -> GraphV2: - return self.graph - - def __exit__( - self, - exception_type: Optional[Type[BaseException]], - exception_value: Optional[BaseException], - traceback: Optional[TracebackType], - ) -> None: - self.graph.drop() diff --git a/graphdatascience/procedure_surface/api/model/graphsage_model.py b/graphdatascience/procedure_surface/api/model/graphsage_model.py index 9e1aa65ba..ca2dcffe7 100644 --- a/graphdatascience/procedure_surface/api/model/graphsage_model.py +++ b/graphdatascience/procedure_surface/api/model/graphsage_model.py @@ -7,7 +7,7 @@ from graphdatascience.model.v2.model_api import ModelApi from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 from graphdatascience.procedure_surface.api.estimation_result import EstimationResult -from graphdatascience.procedure_surface.api.graphsage_predict_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.graphsage_predict_endpoints import ( GraphSageMutateResult, GraphSagePredictEndpoints, GraphSageWriteResult, diff --git a/graphdatascience/procedure_surface/api/node_embedding/__init__.py b/graphdatascience/procedure_surface/api/node_embedding/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/graphdatascience/procedure_surface/api/fastrp_endpoints.py b/graphdatascience/procedure_surface/api/node_embedding/fastrp_endpoints.py similarity index 99% rename from graphdatascience/procedure_surface/api/fastrp_endpoints.py rename to graphdatascience/procedure_surface/api/node_embedding/fastrp_endpoints.py index edafb6b2d..245a4f3b9 100644 --- a/graphdatascience/procedure_surface/api/fastrp_endpoints.py +++ b/graphdatascience/procedure_surface/api/node_embedding/fastrp_endpoints.py @@ -8,7 +8,7 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class FastRPEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/graphsage_predict_endpoints.py b/graphdatascience/procedure_surface/api/node_embedding/graphsage_predict_endpoints.py similarity index 100% rename from graphdatascience/procedure_surface/api/graphsage_predict_endpoints.py rename to graphdatascience/procedure_surface/api/node_embedding/graphsage_predict_endpoints.py diff --git a/graphdatascience/procedure_surface/api/graphsage_train_endpoints.py b/graphdatascience/procedure_surface/api/node_embedding/graphsage_train_endpoints.py similarity index 100% rename from graphdatascience/procedure_surface/api/graphsage_train_endpoints.py rename to graphdatascience/procedure_surface/api/node_embedding/graphsage_train_endpoints.py diff --git a/graphdatascience/procedure_surface/api/hashgnn_endpoints.py b/graphdatascience/procedure_surface/api/node_embedding/hashgnn_endpoints.py similarity index 99% rename from graphdatascience/procedure_surface/api/hashgnn_endpoints.py rename to graphdatascience/procedure_surface/api/node_embedding/hashgnn_endpoints.py index 0f4dad0bd..1c405d8c6 100644 --- a/graphdatascience/procedure_surface/api/hashgnn_endpoints.py +++ b/graphdatascience/procedure_surface/api/node_embedding/hashgnn_endpoints.py @@ -8,7 +8,7 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class HashGNNEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/api/node2vec_endpoints.py b/graphdatascience/procedure_surface/api/node_embedding/node2vec_endpoints.py similarity index 99% rename from graphdatascience/procedure_surface/api/node2vec_endpoints.py rename to graphdatascience/procedure_surface/api/node_embedding/node2vec_endpoints.py index db6714ca7..7ea26fb99 100644 --- a/graphdatascience/procedure_surface/api/node2vec_endpoints.py +++ b/graphdatascience/procedure_surface/api/node_embedding/node2vec_endpoints.py @@ -8,7 +8,7 @@ from graphdatascience.procedure_surface.api.base_result import BaseResult from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from .estimation_result import EstimationResult +from graphdatascience.procedure_surface.api.estimation_result import EstimationResult class Node2VecEndpoints(ABC): diff --git a/graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py index b4cc734ca..4c356f073 100644 --- a/graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.articlerank_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articlerank_endpoints import ( ArticleRankEndpoints, ArticleRankMutateResult, ArticleRankStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py index b9bac58a3..f37a87e7c 100644 --- a/graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.articulationpoints_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articulationpoints_endpoints import ( ArticulationPointsEndpoints, ArticulationPointsMutateResult, ArticulationPointsStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py index d9f72ffa6..d25c33a50 100644 --- a/graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.betweenness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.betweenness_endpoints import ( BetweennessEndpoints, BetweennessMutateResult, BetweennessStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py index bd129a1d8..0ca08089d 100644 --- a/graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py @@ -18,7 +18,7 @@ GraphWithGenerationStats, RelationshipPropertySpec, ) -from graphdatascience.procedure_surface.api.graph_sampling_endpoints import GraphSamplingEndpoints +from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import GraphSamplingEndpoints from graphdatascience.procedure_surface.arrow.catalog.graph_backend_arrow import get_graph from graphdatascience.procedure_surface.arrow.catalog.graph_ops_arrow import GraphOpsArrow from graphdatascience.procedure_surface.arrow.catalog.node_label_arrow_endpoints import NodeLabelArrowEndpoints diff --git a/graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py index 355c4a11e..c0bb0edc3 100644 --- a/graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.celf_endpoints import CelfEndpoints, CelfMutateResult, CelfStatsResult, CelfWriteResult +from graphdatascience.procedure_surface.api.centrality.celf_endpoints import CelfEndpoints, CelfMutateResult, CelfStatsResult, CelfWriteResult from ..api.estimation_result import EstimationResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py index fbf72cab2..4a066a567 100644 --- a/graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.closeness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_endpoints import ( ClosenessEndpoints, ClosenessMutateResult, ClosenessStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/closeness_harmonic_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/closeness_harmonic_arrow_endpoints.py index cad3a2542..c128d8c30 100644 --- a/graphdatascience/procedure_surface/arrow/closeness_harmonic_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/closeness_harmonic_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.closeness_harmonic_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_harmonic_endpoints import ( ClosenessHarmonicEndpoints, ClosenessHarmonicMutateResult, ClosenessHarmonicStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/degree_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/degree_arrow_endpoints.py index 686bdaf9e..639bc70c5 100644 --- a/graphdatascience/procedure_surface/arrow/degree_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/degree_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.degree_endpoints import DegreeEndpoints, DegreeMutateResult, DegreeStatsResult, DegreeWriteResult +from graphdatascience.procedure_surface.api.centrality.degree_endpoints import DegreeEndpoints, DegreeMutateResult, DegreeStatsResult, DegreeWriteResult from ..api.estimation_result import EstimationResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/eigenvector_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/eigenvector_arrow_endpoints.py index 09a7ea3d7..e7f8564f3 100644 --- a/graphdatascience/procedure_surface/arrow/eigenvector_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/eigenvector_arrow_endpoints.py @@ -6,7 +6,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient -from ..api.eigenvector_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.eigenvector_endpoints import ( EigenvectorEndpoints, EigenvectorMutateResult, EigenvectorStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/fastrp_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/fastrp_arrow_endpoints.py index b742e0d4c..485396775 100644 --- a/graphdatascience/procedure_surface/arrow/fastrp_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/fastrp_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.fastrp_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.fastrp_endpoints import ( FastRPEndpoints, FastRPMutateResult, FastRPStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/graph_sampling_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/graph_sampling_arrow_endpoints.py index 746db16ee..35c7a9ed5 100644 --- a/graphdatascience/procedure_surface/arrow/graph_sampling_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/graph_sampling_arrow_endpoints.py @@ -5,7 +5,7 @@ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient from graphdatascience.arrow_client.v2.job_client import JobClient from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.graph_sampling_endpoints import ( +from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import ( GraphSamplingEndpoints, GraphSamplingResult, GraphWithSamplingResult, diff --git a/graphdatascience/procedure_surface/arrow/graphsage_predict_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/graphsage_predict_arrow_endpoints.py index ef4cf207e..df0c493fb 100644 --- a/graphdatascience/procedure_surface/arrow/graphsage_predict_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/graphsage_predict_arrow_endpoints.py @@ -4,7 +4,7 @@ from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 from graphdatascience.procedure_surface.api.estimation_result import EstimationResult -from graphdatascience.procedure_surface.api.graphsage_predict_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.graphsage_predict_endpoints import ( GraphSageMutateResult, GraphSagePredictEndpoints, GraphSageWriteResult, diff --git a/graphdatascience/procedure_surface/arrow/graphsage_train_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/graphsage_train_arrow_endpoints.py index 3585e6346..72dc3cda4 100644 --- a/graphdatascience/procedure_surface/arrow/graphsage_train_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/graphsage_train_arrow_endpoints.py @@ -5,7 +5,7 @@ from graphdatascience.procedure_surface.arrow.graphsage_predict_arrow_endpoints import GraphSagePredictArrowEndpoints from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient -from ..api.graphsage_train_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.graphsage_train_endpoints import ( GraphSageTrainEndpoints, GraphSageTrainResult, ) diff --git a/graphdatascience/procedure_surface/arrow/hashgnn_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/hashgnn_arrow_endpoints.py index 28d863d04..c38e064f3 100644 --- a/graphdatascience/procedure_surface/arrow/hashgnn_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/hashgnn_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.hashgnn_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.hashgnn_endpoints import ( HashGNNEndpoints, HashGNNMutateResult, HashGNNWriteResult, diff --git a/graphdatascience/procedure_surface/arrow/k1coloring_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/k1coloring_arrow_endpoints.py index 134e67b28..9cef8ba20 100644 --- a/graphdatascience/procedure_surface/arrow/k1coloring_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/k1coloring_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.k1coloring_endpoints import ( +from graphdatascience.procedure_surface.api.community.k1coloring_endpoints import ( K1ColoringEndpoints, K1ColoringMutateResult, K1ColoringStatsResult, diff --git a/graphdatascience/procedure_surface/arrow/kcore_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/kcore_arrow_endpoints.py index 9f182c491..1f9991985 100644 --- a/graphdatascience/procedure_surface/arrow/kcore_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/kcore_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.kcore_endpoints import KCoreEndpoints, KCoreMutateResult, KCoreStatsResult, KCoreWriteResult +from graphdatascience.procedure_surface.api.community.kcore_endpoints import KCoreEndpoints, KCoreMutateResult, KCoreStatsResult, KCoreWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/louvain_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/louvain_arrow_endpoints.py index 39fd1ccf2..99508ba48 100644 --- a/graphdatascience/procedure_surface/arrow/louvain_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/louvain_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.louvain_endpoints import LouvainEndpoints, LouvainMutateResult, LouvainStatsResult, LouvainWriteResult +from graphdatascience.procedure_surface.api.community.louvain_endpoints import LouvainEndpoints, LouvainMutateResult, LouvainStatsResult, LouvainWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/node2vec_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/node2vec_arrow_endpoints.py index 0da64cab6..b44b47f9a 100644 --- a/graphdatascience/procedure_surface/arrow/node2vec_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/node2vec_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.node2vec_endpoints import Node2VecEndpoints, Node2VecMutateResult, Node2VecWriteResult +from graphdatascience.procedure_surface.api.node_embedding.node2vec_endpoints import Node2VecEndpoints, Node2VecMutateResult, Node2VecWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/pagerank_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/pagerank_arrow_endpoints.py index f5ed916ea..57e2a8633 100644 --- a/graphdatascience/procedure_surface/arrow/pagerank_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/pagerank_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.pagerank_endpoints import PageRankEndpoints, PageRankMutateResult, PageRankStatsResult, PageRankWriteResult +from graphdatascience.procedure_surface.api.centrality.pagerank_endpoints import PageRankEndpoints, PageRankMutateResult, PageRankStatsResult, PageRankWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/scc_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/scc_arrow_endpoints.py index 811d63e1e..a3a0d3e1d 100644 --- a/graphdatascience/procedure_surface/arrow/scc_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/scc_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.scc_endpoints import SccEndpoints, SccMutateResult, SccStatsResult, SccWriteResult +from graphdatascience.procedure_surface.api.community.scc_endpoints import SccEndpoints, SccMutateResult, SccStatsResult, SccWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/arrow/wcc_arrow_endpoints.py b/graphdatascience/procedure_surface/arrow/wcc_arrow_endpoints.py index 105668c7c..9e1fa3aa7 100644 --- a/graphdatascience/procedure_surface/arrow/wcc_arrow_endpoints.py +++ b/graphdatascience/procedure_surface/arrow/wcc_arrow_endpoints.py @@ -7,7 +7,7 @@ from ...arrow_client.authenticated_flight_client import AuthenticatedArrowClient from ...arrow_client.v2.remote_write_back_client import RemoteWriteBackClient from ..api.estimation_result import EstimationResult -from ..api.wcc_endpoints import WccEndpoints, WccMutateResult, WccStatsResult, WccWriteResult +from graphdatascience.procedure_surface.api.community.wcc_endpoints import WccEndpoints, WccMutateResult, WccStatsResult, WccWriteResult from .node_property_endpoints import NodePropertyEndpoints diff --git a/graphdatascience/procedure_surface/cypher/articlerank_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/articlerank_cypher_endpoints.py index 53552ade0..bdb0b351d 100644 --- a/graphdatascience/procedure_surface/cypher/articlerank_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/articlerank_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.articlerank_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articlerank_endpoints import ( ArticleRankEndpoints, ArticleRankMutateResult, ArticleRankStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/articulationpoints_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/articulationpoints_cypher_endpoints.py index 6e795f978..6859e8536 100644 --- a/graphdatascience/procedure_surface/cypher/articulationpoints_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/articulationpoints_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.articulationpoints_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articulationpoints_endpoints import ( ArticulationPointsEndpoints, ArticulationPointsMutateResult, ArticulationPointsStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/betweenness_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/betweenness_cypher_endpoints.py index ab6c47b50..658ca666a 100644 --- a/graphdatascience/procedure_surface/cypher/betweenness_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/betweenness_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.betweenness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.betweenness_endpoints import ( BetweennessEndpoints, BetweennessMutateResult, BetweennessStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/catalog_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/catalog_cypher_endpoints.py index 5b44ff486..13913e305 100644 --- a/graphdatascience/procedure_surface/cypher/catalog_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/catalog_cypher_endpoints.py @@ -10,7 +10,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.base_result import BaseResult -from ..api.catalog_endpoints import ( +from graphdatascience.procedure_surface.api.catalog_endpoints import ( CatalogEndpoints, GraphFilterResult, GraphGenerationStats, @@ -18,7 +18,7 @@ GraphWithGenerationStats, RelationshipPropertySpec, ) -from ..api.graph_sampling_endpoints import GraphSamplingEndpoints +from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import GraphSamplingEndpoints from ..utils.config_converter import ConfigConverter from .catalog.node_label_cypher_endpoints import NodeLabelCypherEndpoints from .catalog.node_properties_cypher_endpoints import NodePropertiesCypherEndpoints diff --git a/graphdatascience/procedure_surface/cypher/celf_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/celf_cypher_endpoints.py index 3452bd6b3..95691a0ca 100644 --- a/graphdatascience/procedure_surface/cypher/celf_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/celf_cypher_endpoints.py @@ -6,7 +6,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.celf_endpoints import CelfEndpoints, CelfMutateResult, CelfStatsResult, CelfWriteResult +from graphdatascience.procedure_surface.api.centrality.celf_endpoints import CelfEndpoints, CelfMutateResult, CelfStatsResult, CelfWriteResult from ..api.estimation_result import EstimationResult from ..utils.config_converter import ConfigConverter from .estimation_utils import estimate_algorithm diff --git a/graphdatascience/procedure_surface/cypher/closeness_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/closeness_cypher_endpoints.py index caa9c6194..4094f0a81 100644 --- a/graphdatascience/procedure_surface/cypher/closeness_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/closeness_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.closeness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_endpoints import ( ClosenessEndpoints, ClosenessMutateResult, ClosenessStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/closeness_harmonic_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/closeness_harmonic_cypher_endpoints.py index 1dc348f4a..99c08ff79 100644 --- a/graphdatascience/procedure_surface/cypher/closeness_harmonic_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/closeness_harmonic_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.closeness_harmonic_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_harmonic_endpoints import ( ClosenessHarmonicEndpoints, ClosenessHarmonicMutateResult, ClosenessHarmonicStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/degree_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/degree_cypher_endpoints.py index 8c5d9b9c6..bf19d6b06 100644 --- a/graphdatascience/procedure_surface/cypher/degree_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/degree_cypher_endpoints.py @@ -6,7 +6,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.degree_endpoints import DegreeEndpoints, DegreeMutateResult, DegreeStatsResult, DegreeWriteResult +from graphdatascience.procedure_surface.api.centrality.degree_endpoints import DegreeEndpoints, DegreeMutateResult, DegreeStatsResult, DegreeWriteResult from ..api.estimation_result import EstimationResult from ..utils.config_converter import ConfigConverter from .estimation_utils import estimate_algorithm diff --git a/graphdatascience/procedure_surface/cypher/eigenvector_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/eigenvector_cypher_endpoints.py index 6e44ff323..451ebf5b0 100644 --- a/graphdatascience/procedure_surface/cypher/eigenvector_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/eigenvector_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.eigenvector_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.eigenvector_endpoints import ( EigenvectorEndpoints, EigenvectorMutateResult, EigenvectorStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/fastrp_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/fastrp_cypher_endpoints.py index 9fd2eb9d9..c2000f150 100644 --- a/graphdatascience/procedure_surface/cypher/fastrp_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/fastrp_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.fastrp_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.fastrp_endpoints import ( FastRPEndpoints, FastRPMutateResult, FastRPStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/graph_sampling_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/graph_sampling_cypher_endpoints.py index ed9187e61..cda932632 100644 --- a/graphdatascience/procedure_surface/cypher/graph_sampling_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/graph_sampling_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.graph_sampling_endpoints import GraphSamplingEndpoints, GraphSamplingResult, GraphWithSamplingResult +from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import GraphSamplingEndpoints, GraphSamplingResult, GraphWithSamplingResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/procedure_surface/cypher/graphsage_predict_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/graphsage_predict_cypher_endpoints.py index 2d0c0e00a..b0519b251 100644 --- a/graphdatascience/procedure_surface/cypher/graphsage_predict_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/graphsage_predict_cypher_endpoints.py @@ -5,7 +5,7 @@ from graphdatascience.call_parameters import CallParameters from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 from graphdatascience.procedure_surface.api.estimation_result import EstimationResult -from graphdatascience.procedure_surface.api.graphsage_predict_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.graphsage_predict_endpoints import ( GraphSageMutateResult, GraphSagePredictEndpoints, GraphSageWriteResult, diff --git a/graphdatascience/procedure_surface/cypher/graphsage_train_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/graphsage_train_cypher_endpoints.py index d550e50f7..e663d34ed 100644 --- a/graphdatascience/procedure_surface/cypher/graphsage_train_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/graphsage_train_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner -from ..api.graphsage_train_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.graphsage_train_endpoints import ( GraphSageTrainEndpoints, GraphSageTrainResult, ) diff --git a/graphdatascience/procedure_surface/cypher/hashgnn_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/hashgnn_cypher_endpoints.py index b6f496e91..e01a2ee57 100644 --- a/graphdatascience/procedure_surface/cypher/hashgnn_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/hashgnn_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.hashgnn_endpoints import ( +from graphdatascience.procedure_surface.api.node_embedding.hashgnn_endpoints import ( HashGNNEndpoints, HashGNNMutateResult, HashGNNWriteResult, diff --git a/graphdatascience/procedure_surface/cypher/k1coloring_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/k1coloring_cypher_endpoints.py index e3a29cbd5..900b713ee 100644 --- a/graphdatascience/procedure_surface/cypher/k1coloring_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/k1coloring_cypher_endpoints.py @@ -8,7 +8,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.k1coloring_endpoints import ( +from graphdatascience.procedure_surface.api.community.k1coloring_endpoints import ( K1ColoringEndpoints, K1ColoringMutateResult, K1ColoringStatsResult, diff --git a/graphdatascience/procedure_surface/cypher/kcore_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/kcore_cypher_endpoints.py index 81ed4e09f..ce9b3706e 100644 --- a/graphdatascience/procedure_surface/cypher/kcore_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/kcore_cypher_endpoints.py @@ -8,7 +8,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.kcore_endpoints import KCoreEndpoints, KCoreMutateResult, KCoreStatsResult, KCoreWriteResult +from graphdatascience.procedure_surface.api.community.kcore_endpoints import KCoreEndpoints, KCoreMutateResult, KCoreStatsResult, KCoreWriteResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/procedure_surface/cypher/louvain_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/louvain_cypher_endpoints.py index 80d9434f0..f1e510f1e 100644 --- a/graphdatascience/procedure_surface/cypher/louvain_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/louvain_cypher_endpoints.py @@ -8,7 +8,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.louvain_endpoints import LouvainEndpoints, LouvainMutateResult, LouvainStatsResult, LouvainWriteResult +from graphdatascience.procedure_surface.api.community.louvain_endpoints import LouvainEndpoints, LouvainMutateResult, LouvainStatsResult, LouvainWriteResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/procedure_surface/cypher/node2vec_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/node2vec_cypher_endpoints.py index 0ba0c8c29..39532479f 100644 --- a/graphdatascience/procedure_surface/cypher/node2vec_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/node2vec_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.node2vec_endpoints import Node2VecEndpoints, Node2VecMutateResult, Node2VecWriteResult +from graphdatascience.procedure_surface.api.node_embedding.node2vec_endpoints import Node2VecEndpoints, Node2VecMutateResult, Node2VecWriteResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/procedure_surface/cypher/pagerank_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/pagerank_cypher_endpoints.py index c8482fec2..64001ffa3 100644 --- a/graphdatascience/procedure_surface/cypher/pagerank_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/pagerank_cypher_endpoints.py @@ -7,7 +7,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.pagerank_endpoints import PageRankEndpoints, PageRankMutateResult, PageRankStatsResult, PageRankWriteResult +from graphdatascience.procedure_surface.api.centrality.pagerank_endpoints import PageRankEndpoints, PageRankMutateResult, PageRankStatsResult, PageRankWriteResult from ..utils.config_converter import ConfigConverter from .estimation_utils import estimate_algorithm diff --git a/graphdatascience/procedure_surface/cypher/scc_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/scc_cypher_endpoints.py index d59857d05..0c17b2d4f 100644 --- a/graphdatascience/procedure_surface/cypher/scc_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/scc_cypher_endpoints.py @@ -8,7 +8,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.scc_endpoints import SccEndpoints, SccMutateResult, SccStatsResult, SccWriteResult +from graphdatascience.procedure_surface.api.community.scc_endpoints import SccEndpoints, SccMutateResult, SccStatsResult, SccWriteResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/procedure_surface/cypher/wcc_cypher_endpoints.py b/graphdatascience/procedure_surface/cypher/wcc_cypher_endpoints.py index 1cfb48871..9ce47ae3a 100644 --- a/graphdatascience/procedure_surface/cypher/wcc_cypher_endpoints.py +++ b/graphdatascience/procedure_surface/cypher/wcc_cypher_endpoints.py @@ -8,7 +8,7 @@ from ...call_parameters import CallParameters from ...query_runner.query_runner import QueryRunner from ..api.estimation_result import EstimationResult -from ..api.wcc_endpoints import WccEndpoints, WccMutateResult, WccStatsResult, WccWriteResult +from graphdatascience.procedure_surface.api.community.wcc_endpoints import WccEndpoints, WccMutateResult, WccStatsResult, WccWriteResult from ..utils.config_converter import ConfigConverter diff --git a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_articulationpoints_arrow_endpoints.py b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_articulationpoints_arrow_endpoints.py index 514df3d45..5efe8e341 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_articulationpoints_arrow_endpoints.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_articulationpoints_arrow_endpoints.py @@ -3,7 +3,7 @@ import pytest from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient -from graphdatascience.procedure_surface.api.articulationpoints_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articulationpoints_endpoints import ( ArticulationPointsMutateResult, ArticulationPointsStatsResult, ) diff --git a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_betweenness_arrow_endpoints.py b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_betweenness_arrow_endpoints.py index 6b84752b0..99d424134 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_betweenness_arrow_endpoints.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_betweenness_arrow_endpoints.py @@ -3,7 +3,7 @@ import pytest from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient -from graphdatascience.procedure_surface.api.betweenness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.betweenness_endpoints import ( BetweennessMutateResult, BetweennessStatsResult, ) diff --git a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_scc_arrow_endpoints.py b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_scc_arrow_endpoints.py index d5c8a7ce5..ef0d2d5bd 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_scc_arrow_endpoints.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/arrow/test_scc_arrow_endpoints.py @@ -4,7 +4,7 @@ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.scc_endpoints import SccMutateResult, SccStatsResult +from graphdatascience.procedure_surface.api.community.scc_endpoints import SccMutateResult, SccStatsResult from graphdatascience.procedure_surface.arrow.scc_arrow_endpoints import SccArrowEndpoints from graphdatascience.tests.integrationV2.procedure_surface.arrow.graph_creation_helper import create_graph diff --git a/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_articulationpoints_cypher_endpoints.py b/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_articulationpoints_cypher_endpoints.py index a1fa04922..10fefe969 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_articulationpoints_cypher_endpoints.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_articulationpoints_cypher_endpoints.py @@ -3,7 +3,7 @@ import pytest from pandas import DataFrame -from graphdatascience.procedure_surface.api.articulationpoints_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articulationpoints_endpoints import ( ArticulationPointsMutateResult, ArticulationPointsStatsResult, ArticulationPointsWriteResult, diff --git a/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_scc_cypher_endpoints.py b/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_scc_cypher_endpoints.py index 184d87c2b..b3a5d4ec2 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_scc_cypher_endpoints.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/cypher/test_scc_cypher_endpoints.py @@ -4,7 +4,7 @@ from graphdatascience import QueryRunner from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.scc_endpoints import SccMutateResult, SccStatsResult, SccWriteResult +from graphdatascience.procedure_surface.api.community.scc_endpoints import SccMutateResult, SccStatsResult, SccWriteResult from graphdatascience.procedure_surface.cypher.scc_cypher_endpoints import SccCypherEndpoints from graphdatascience.tests.integrationV2.procedure_surface.cypher.cypher_graph_helper import create_graph diff --git a/graphdatascience/tests/integrationV2/procedure_surface/session/test_walking_skeleton.py b/graphdatascience/tests/integrationV2/procedure_surface/session/test_walking_skeleton.py index 9ed81668a..7b2498557 100644 --- a/graphdatascience/tests/integrationV2/procedure_surface/session/test_walking_skeleton.py +++ b/graphdatascience/tests/integrationV2/procedure_surface/session/test_walking_skeleton.py @@ -53,3 +53,5 @@ def test_walking_skeleton(gds: AuraGraphDataScience) -> None: drop_result = gds.v2.graph.node_properties.drop(G, node_properties=["wcc"]) assert drop_result.properties_removed == 2 + + gds.v2.graph.sample.rwr() diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articlerank_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articlerank_cypher_endpoints.py index d9d27fe50..26b213890 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articlerank_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articlerank_cypher_endpoints.py @@ -1,7 +1,7 @@ import pandas as pd import pytest -from graphdatascience.procedure_surface.api.articlerank_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articlerank_endpoints import ( ArticleRankMutateResult, ArticleRankStatsResult, ArticleRankWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articulationpoints_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articulationpoints_cypher_endpoints.py index 50b76743a..c703c516c 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articulationpoints_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_articulationpoints_cypher_endpoints.py @@ -1,7 +1,7 @@ import pandas as pd import pytest -from graphdatascience.procedure_surface.api.articulationpoints_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.articulationpoints_endpoints import ( ArticulationPointsMutateResult, ArticulationPointsStatsResult, ArticulationPointsWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_betweenness_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_betweenness_cypher_endpoints.py index 956c67dca..1bbfe207e 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_betweenness_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_betweenness_cypher_endpoints.py @@ -1,7 +1,7 @@ import pandas as pd import pytest -from graphdatascience.procedure_surface.api.betweenness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.betweenness_endpoints import ( BetweennessMutateResult, BetweennessStatsResult, BetweennessWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_celf_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_celf_cypher_endpoints.py index 6b29c0a68..3b1660660 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_celf_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_celf_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.celf_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.celf_endpoints import ( CelfMutateResult, CelfStatsResult, CelfWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_cypher_endpoints.py index 1496fdf81..abc76ea68 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.closeness_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_endpoints import ( ClosenessStatsResult, ClosenessWriteResult, ) diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_harmonic_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_harmonic_cypher_endpoints.py index 2bb65b864..30fc67814 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_harmonic_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_closeness_harmonic_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.closeness_harmonic_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.closeness_harmonic_endpoints import ( ClosenessHarmonicStatsResult, ClosenessHarmonicWriteResult, ) diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_degree_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_degree_cypher_endpoints.py index 976f109f1..566fd1337 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_degree_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_degree_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.degree_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.degree_endpoints import ( DegreeMutateResult, DegreeStatsResult, DegreeWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_eigenvector_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_eigenvector_cypher_endpoints.py index 436845983..103c2d855 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_eigenvector_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_eigenvector_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.eigenvector_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.eigenvector_endpoints import ( EigenvectorMutateResult, EigenvectorStatsResult, EigenvectorWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_k1coloring_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_k1coloring_cypher_endpoints.py index 054047de3..3848d8a58 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_k1coloring_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_k1coloring_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.k1coloring_endpoints import ( +from graphdatascience.procedure_surface.api.community.k1coloring_endpoints import ( K1ColoringMutateResult, K1ColoringStatsResult, K1ColoringWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_louvain_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_louvain_cypher_endpoints.py index a54ad2f28..d95468829 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_louvain_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_louvain_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.louvain_endpoints import ( +from graphdatascience.procedure_surface.api.community.louvain_endpoints import ( LouvainMutateResult, LouvainStatsResult, LouvainWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_pagerank_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_pagerank_cypher_endpoints.py index 5a720004b..570641e9d 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_pagerank_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_pagerank_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.pagerank_endpoints import ( +from graphdatascience.procedure_surface.api.centrality.pagerank_endpoints import ( PageRankMutateResult, PageRankStatsResult, PageRankWriteResult, diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_scc_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_scc_cypher_endpoints.py index 72359b49f..ce5c26877 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_scc_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_scc_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.scc_endpoints import SccMutateResult, SccStatsResult, SccWriteResult +from graphdatascience.procedure_surface.api.community.scc_endpoints import SccMutateResult, SccStatsResult, SccWriteResult from graphdatascience.procedure_surface.cypher.catalog.graph_backend_cypher import get_graph from graphdatascience.procedure_surface.cypher.scc_cypher_endpoints import SccCypherEndpoints from graphdatascience.tests.unit.conftest import DEFAULT_SERVER_VERSION, CollectingQueryRunner diff --git a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_wcc_cypher_endpoints.py b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_wcc_cypher_endpoints.py index efdea2297..ba82dc01a 100644 --- a/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_wcc_cypher_endpoints.py +++ b/graphdatascience/tests/unit/procedure_surface/cypher/test_unit_wcc_cypher_endpoints.py @@ -2,7 +2,7 @@ import pytest from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2 -from graphdatascience.procedure_surface.api.wcc_endpoints import WccMutateResult, WccStatsResult, WccWriteResult +from graphdatascience.procedure_surface.api.community.wcc_endpoints import WccMutateResult, WccStatsResult, WccWriteResult from graphdatascience.procedure_surface.cypher.catalog.graph_backend_cypher import get_graph from graphdatascience.procedure_surface.cypher.wcc_cypher_endpoints import WccCypherEndpoints from graphdatascience.tests.unit.conftest import DEFAULT_SERVER_VERSION, CollectingQueryRunner