graphdatascience 2.0a1__py3-none-any.whl → 2.0a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. graphdatascience/__init__.py +6 -4
  2. graphdatascience/arrow_client/arrow_endpoint_version.py +18 -10
  3. graphdatascience/graph/graph_api.py +4 -4
  4. graphdatascience/graph/graph_backend.py +1 -1
  5. graphdatascience/graph_construction/cypher_graph_constructor.py +5 -4
  6. graphdatascience/graph_data_science.py +58 -20
  7. graphdatascience/model/model.py +66 -8
  8. graphdatascience/model/model_catalog_protocol.py +29 -0
  9. graphdatascience/procedure_surface/__init__.py +0 -3
  10. graphdatascience/procedure_surface/api/base_result.py +1 -1
  11. graphdatascience/procedure_surface/api/catalog/__init__.py +8 -5
  12. graphdatascience/procedure_surface/api/catalog/catalog_endpoints.py +24 -18
  13. graphdatascience/procedure_surface/api/catalog/graph_export_endpoints.py +142 -0
  14. graphdatascience/procedure_surface/api/catalog/node_label_endpoints.py +0 -6
  15. graphdatascience/procedure_surface/api/centrality/__init__.py +10 -0
  16. graphdatascience/procedure_surface/api/centrality/hits_endpoints.py +258 -0
  17. graphdatascience/procedure_surface/api/estimation_result.py +3 -2
  18. graphdatascience/procedure_surface/api/memory_endpoints.py +46 -0
  19. graphdatascience/procedure_surface/api/model/model_catalog_endpoints.py +1 -0
  20. graphdatascience/procedure_surface/api/node_embedding/fastpath_endpoints.py +13 -4
  21. graphdatascience/procedure_surface/api/node_embedding/graphsage_endpoints.py +7 -0
  22. graphdatascience/procedure_surface/api/{model → node_embedding}/graphsage_model.py +3 -3
  23. graphdatascience/procedure_surface/api/node_embedding/graphsage_train_endpoints.py +1 -1
  24. graphdatascience/procedure_surface/api/pathfinding/__init__.py +2 -0
  25. graphdatascience/procedure_surface/api/pathfinding/dag_endpoints.py +7 -0
  26. graphdatascience/procedure_surface/api/pathfinding/topological_sort_endpoints.py +54 -0
  27. graphdatascience/procedure_surface/api/pipeline/__init__.py +3 -1
  28. graphdatascience/procedure_surface/api/{model → pipeline}/link_prediction_model.py +4 -4
  29. graphdatascience/procedure_surface/api/pipeline/link_prediction_pipeline.py +7 -1
  30. graphdatascience/procedure_surface/api/pipeline/link_prediction_predict_endpoints.py +133 -0
  31. graphdatascience/procedure_surface/api/pipeline/link_prediction_train_endpoints.py +1 -1
  32. graphdatascience/procedure_surface/api/{model → pipeline}/node_classification_model.py +4 -4
  33. graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline.py +9 -1
  34. graphdatascience/procedure_surface/api/pipeline/node_classification_train_endpoints.py +1 -1
  35. graphdatascience/procedure_surface/api/{model → pipeline}/node_regression_model.py +4 -4
  36. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline.py +7 -1
  37. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_endpoints.py +1 -1
  38. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_protocol.py +1 -1
  39. graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_protocol.py +8 -1
  40. graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_result.py +19 -0
  41. graphdatascience/procedure_surface/api/pipeline/pipeline_endpoints.py +14 -15
  42. graphdatascience/procedure_surface/api/pipeline/pipeline_info_mapping.py +33 -0
  43. graphdatascience/procedure_surface/api/util_endpoints.py +21 -0
  44. graphdatascience/procedure_surface/api/write_job_handle.py +6 -1
  45. graphdatascience/procedure_surface/arrow/catalog/__init__.py +1 -2
  46. graphdatascience/procedure_surface/arrow/catalog/catalog_arrow_endpoints.py +32 -273
  47. graphdatascience/procedure_surface/arrow/catalog/graph_backend_arrow.py +1 -1
  48. graphdatascience/procedure_surface/arrow/catalog/graph_export_arrow_endpoints.py +49 -0
  49. graphdatascience/procedure_surface/arrow/catalog/graph_ops_arrow.py +1 -1
  50. graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py +0 -4
  51. graphdatascience/procedure_surface/arrow/catalog/projection_arrow_endpoints.py +300 -0
  52. graphdatascience/procedure_surface/arrow/node_embedding/fastpath_arrow_endpoints.py +66 -0
  53. graphdatascience/procedure_surface/arrow/node_embedding/graphsage_predict_arrow_endpoints.py +0 -2
  54. graphdatascience/procedure_surface/arrow/node_embedding/graphsage_train_arrow_endpoints.py +4 -4
  55. graphdatascience/procedure_surface/arrow/pathfinding/dag_arrow_endpoints.py +9 -0
  56. graphdatascience/procedure_surface/arrow/pathfinding/topological_sort_arrow_endpoints.py +51 -0
  57. graphdatascience/procedure_surface/arrow/pipeline/link_prediction_pipeline_arrow_endpoints.py +6 -8
  58. graphdatascience/procedure_surface/arrow/pipeline/link_prediction_train_arrow_endpoints.py +5 -5
  59. graphdatascience/procedure_surface/arrow/pipeline/node_classification_pipeline_arrow_endpoints.py +6 -8
  60. graphdatascience/procedure_surface/arrow/pipeline/node_classification_train_arrow_endpoints.py +5 -5
  61. graphdatascience/procedure_surface/arrow/pipeline/node_regression_pipeline_arrow_endpoints.py +7 -9
  62. graphdatascience/procedure_surface/arrow/pipeline/pipeline_catalog_arrow_endpoints.py +12 -6
  63. graphdatascience/procedure_surface/arrow/stream_result_mapper.py +8 -0
  64. graphdatascience/procedure_surface/arrow/util_arrow_endpoints.py +16 -18
  65. graphdatascience/procedure_surface/cypher/catalog/__init__.py +8 -2
  66. graphdatascience/procedure_surface/cypher/catalog/catalog_cypher_endpoints.py +67 -149
  67. graphdatascience/{graph → procedure_surface/cypher/catalog}/graph_backend_cypher.py +10 -4
  68. graphdatascience/procedure_surface/cypher/catalog/graph_export_cypher_endpoints.py +97 -0
  69. graphdatascience/procedure_surface/cypher/catalog/graph_sampling_cypher_endpoints.py +5 -5
  70. graphdatascience/procedure_surface/cypher/catalog/node_label_cypher_endpoints.py +5 -15
  71. graphdatascience/procedure_surface/cypher/catalog/node_properties_cypher_endpoints.py +4 -4
  72. graphdatascience/procedure_surface/cypher/catalog/projection_cypher_endpoints.py +201 -0
  73. graphdatascience/procedure_surface/cypher/catalog/relationship_cypher_endpoints.py +8 -8
  74. graphdatascience/procedure_surface/cypher/catalog/scale_properties_cypher_endpoints.py +6 -6
  75. graphdatascience/procedure_surface/cypher/catalog/utils.py +20 -0
  76. graphdatascience/procedure_surface/cypher/centrality/articlerank_cypher_endpoints.py +6 -6
  77. graphdatascience/procedure_surface/cypher/centrality/articulationpoints_cypher_endpoints.py +6 -6
  78. graphdatascience/procedure_surface/cypher/centrality/betweenness_cypher_endpoints.py +6 -6
  79. graphdatascience/procedure_surface/cypher/centrality/celf_cypher_endpoints.py +6 -6
  80. graphdatascience/procedure_surface/cypher/centrality/closeness_cypher_endpoints.py +6 -6
  81. graphdatascience/procedure_surface/cypher/centrality/closeness_harmonic_cypher_endpoints.py +6 -6
  82. graphdatascience/procedure_surface/cypher/centrality/degree_cypher_endpoints.py +6 -6
  83. graphdatascience/procedure_surface/cypher/centrality/eigenvector_cypher_endpoints.py +6 -6
  84. graphdatascience/procedure_surface/cypher/centrality/hits_cypher_endpoints.py +179 -0
  85. graphdatascience/procedure_surface/cypher/centrality/pagerank_cypher_endpoints.py +6 -6
  86. graphdatascience/procedure_surface/cypher/collapse_path_cypher_endpoints.py +2 -2
  87. graphdatascience/procedure_surface/cypher/community/clique_counting_cypher_endpoints.py +6 -6
  88. graphdatascience/procedure_surface/cypher/community/hdbscan_cypher_endpoints.py +3 -3
  89. graphdatascience/procedure_surface/cypher/community/k1coloring_cypher_endpoints.py +6 -6
  90. graphdatascience/procedure_surface/cypher/community/kcore_cypher_endpoints.py +6 -6
  91. graphdatascience/procedure_surface/cypher/community/kmeans_cypher_endpoints.py +6 -6
  92. graphdatascience/procedure_surface/cypher/community/labelpropagation_cypher_endpoints.py +6 -6
  93. graphdatascience/procedure_surface/cypher/community/leiden_cypher_endpoints.py +6 -6
  94. graphdatascience/procedure_surface/cypher/community/local_clustering_coefficient_cypher_endpoints.py +6 -6
  95. graphdatascience/procedure_surface/cypher/community/louvain_cypher_endpoints.py +6 -6
  96. graphdatascience/procedure_surface/cypher/community/maxkcut_cypher_endpoints.py +2 -2
  97. graphdatascience/procedure_surface/cypher/community/modularity_cypher_endpoints.py +1 -1
  98. graphdatascience/procedure_surface/cypher/community/modularity_optimization_cypher_endpoints.py +3 -5
  99. graphdatascience/procedure_surface/cypher/community/scc_cypher_endpoints.py +8 -8
  100. graphdatascience/procedure_surface/cypher/community/sllpa_cypher_endpoints.py +3 -3
  101. graphdatascience/procedure_surface/cypher/community/triangle_count_cypher_endpoints.py +6 -6
  102. graphdatascience/procedure_surface/cypher/community/wcc_cypher_endpoints.py +8 -8
  103. graphdatascience/procedure_surface/cypher/config_cypher_endpoints.py +2 -2
  104. graphdatascience/procedure_surface/cypher/estimation_utils.py +2 -2
  105. graphdatascience/procedure_surface/cypher/kge/kge_predict_cypher_endpoints.py +2 -2
  106. graphdatascience/procedure_surface/cypher/license_cypher_endpoints.py +2 -2
  107. graphdatascience/procedure_surface/cypher/list_progress_cypher_endpoint.py +1 -1
  108. graphdatascience/procedure_surface/cypher/memory_cypher_endpoints.py +21 -0
  109. graphdatascience/procedure_surface/cypher/model/model_catalog_cypher_endpoints.py +6 -5
  110. graphdatascience/procedure_surface/cypher/node_embedding/fastrp_cypher_endpoints.py +6 -6
  111. graphdatascience/procedure_surface/cypher/node_embedding/graphsage_predict_cypher_endpoints.py +2 -2
  112. graphdatascience/procedure_surface/cypher/node_embedding/graphsage_train_cypher_endpoints.py +4 -4
  113. graphdatascience/procedure_surface/cypher/node_embedding/hashgnn_cypher_endpoints.py +4 -4
  114. graphdatascience/procedure_surface/cypher/node_embedding/node2vec_cypher_endpoints.py +6 -6
  115. graphdatascience/procedure_surface/cypher/pathfinding/bfs_cypher_endpoints.py +8 -8
  116. graphdatascience/procedure_surface/cypher/pathfinding/dag_cypher_endpoints.py +9 -0
  117. graphdatascience/procedure_surface/cypher/pathfinding/dfs_cypher_endpoints.py +8 -8
  118. graphdatascience/procedure_surface/cypher/pathfinding/dijkstra_cypher_endpoints.py +2 -2
  119. graphdatascience/procedure_surface/cypher/pathfinding/k_spanning_tree_cypher_endpoints.py +3 -3
  120. graphdatascience/procedure_surface/cypher/pathfinding/max_flow_cypher_endpoints.py +6 -6
  121. graphdatascience/procedure_surface/cypher/pathfinding/max_flow_min_cost_cypher_endpoints.py +6 -6
  122. graphdatascience/procedure_surface/cypher/pathfinding/prize_steiner_tree_cypher_endpoints.py +3 -3
  123. graphdatascience/procedure_surface/cypher/pathfinding/random_walk_cypher_endpoints.py +4 -4
  124. graphdatascience/procedure_surface/cypher/pathfinding/single_source_bellman_ford_cypher_endpoints.py +3 -3
  125. graphdatascience/procedure_surface/cypher/pathfinding/single_source_delta_cypher_endpoints.py +3 -3
  126. graphdatascience/procedure_surface/cypher/pathfinding/single_source_dijkstra_cypher_endpoints.py +2 -2
  127. graphdatascience/procedure_surface/cypher/pathfinding/source_target_astar_cypher_endpoints.py +2 -2
  128. graphdatascience/procedure_surface/cypher/pathfinding/source_target_dijkstra_cypher_endpoints.py +2 -2
  129. graphdatascience/procedure_surface/cypher/pathfinding/source_target_yens_cypher_endpoints.py +2 -2
  130. graphdatascience/procedure_surface/cypher/pathfinding/spanning_tree_cypher_endpoints.py +9 -9
  131. graphdatascience/procedure_surface/cypher/pathfinding/steiner_tree_cypher_endpoints.py +5 -9
  132. graphdatascience/procedure_surface/cypher/pathfinding/topological_sort_cypher_endpoints.py +47 -0
  133. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_pipeline_cypher_endpoints.py +19 -21
  134. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_predict_cypher_endpoints.py +3 -3
  135. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_train_cypher_endpoints.py +6 -6
  136. graphdatascience/procedure_surface/cypher/pipeline/node_classification_pipeline_cypher_endpoints.py +19 -21
  137. graphdatascience/procedure_surface/cypher/pipeline/node_classification_predict_cypher_endpoints.py +5 -5
  138. graphdatascience/procedure_surface/cypher/pipeline/node_classification_train_cypher_endpoints.py +6 -6
  139. graphdatascience/procedure_surface/cypher/pipeline/node_regression_pipeline_cypher_endpoints.py +22 -24
  140. graphdatascience/procedure_surface/cypher/pipeline/node_regression_predict_cypher_endpoints.py +2 -2
  141. graphdatascience/procedure_surface/cypher/pipeline/pipeline_catalog_cypher_endpoints.py +13 -7
  142. graphdatascience/procedure_surface/cypher/similarity/knn_cypher_endpoints.py +3 -3
  143. graphdatascience/procedure_surface/cypher/similarity/knn_filtered_cypher_endpoints.py +3 -3
  144. graphdatascience/procedure_surface/cypher/similarity/node_similarity_cypher_endpoints.py +3 -3
  145. graphdatascience/procedure_surface/cypher/similarity/node_similarity_filtered_cypher_endpoints.py +3 -3
  146. graphdatascience/procedure_surface/cypher/topological_link_prediction_cypher_endpoints.py +2 -2
  147. graphdatascience/procedure_surface/cypher/util_cypher_endpoints.py +4 -0
  148. graphdatascience/procedure_surface/utils/node_matching.py +37 -0
  149. graphdatascience/procedure_surface/utils/result_utils.py +5 -0
  150. graphdatascience/progress/progress_bar.py +13 -2
  151. graphdatascience/query_runner/neo4j_query_runner.py +5 -7
  152. graphdatascience/query_runner/query_runner.py +1 -1
  153. graphdatascience/session/aura_api.py +12 -3
  154. graphdatascience/session/aura_graph_data_science.py +9 -11
  155. graphdatascience/session/endpoint_mappings.py +42 -0
  156. graphdatascience/session/gds_sessions.py +31 -2
  157. graphdatascience/session/remote_ops/project_protocols.py +20 -22
  158. graphdatascience/session/remote_ops/projection_runner.py +11 -0
  159. graphdatascience/session/remote_ops/write_protocols.py +1 -1
  160. graphdatascience/version.py +1 -1
  161. graphdatascience/versions/__init__.py +4 -0
  162. {graphdatascience-2.0a1.dist-info → graphdatascience-2.0a2.dist-info}/METADATA +4 -4
  163. {graphdatascience-2.0a1.dist-info → graphdatascience-2.0a2.dist-info}/RECORD +171 -158
  164. {graphdatascience-2.0a1.dist-info → graphdatascience-2.0a2.dist-info}/WHEEL +1 -1
  165. graphdatascience/model/model_api.py +0 -45
  166. graphdatascience/procedure_surface/arrow/model_api_arrow.py +0 -57
  167. graphdatascience/procedure_surface/cypher/model_api_cypher.py +0 -49
  168. graphdatascience/semantic_version/__init__.py +0 -0
  169. graphdatascience/server_version/__init__.py +0 -0
  170. /graphdatascience/{procedure_surface/api/catalog → graph}/graph_info.py +0 -0
  171. /graphdatascience/procedure_surface/api/{model → pipeline}/pipeline_model.py +0 -0
  172. /graphdatascience/{session/dbms → query_runner}/db_environment_resolver.py +0 -0
  173. /graphdatascience/{semantic_version → versions}/semantic_version.py +0 -0
  174. /graphdatascience/{server_version → versions}/server_version.py +0 -0
  175. {graphdatascience-2.0a1.dist-info → graphdatascience-2.0a2.dist-info}/licenses/LICENSE +0 -0
  176. {graphdatascience-2.0a1.dist-info → graphdatascience-2.0a2.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,13 @@
1
- from .graph_data_science import GraphDataScience
2
- from .server_version.server_version import ServerVersion
3
- from .session import GdsSessions
4
- from .version import __version__
1
+ from graphdatascience.graph.graph_api import Graph
2
+ from graphdatascience.graph_data_science import GraphDataScience
3
+ from graphdatascience.session import GdsSessions
4
+ from graphdatascience.version import __version__
5
+ from graphdatascience.versions import ServerVersion
5
6
 
6
7
  __all__ = [
7
8
  "__version__",
8
9
  "ServerVersion",
9
10
  "GraphDataScience",
10
11
  "GdsSessions",
12
+ "Graph",
11
13
  ]
@@ -2,26 +2,34 @@ from __future__ import annotations
2
2
 
3
3
  from enum import Enum
4
4
 
5
+ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
6
+
5
7
 
6
8
  class ArrowEndpointVersion(Enum):
7
- V1 = "v1/"
8
- V2 = "v2/"
9
+ V1 = "v1"
10
+ V2 = "v2"
9
11
 
10
12
  def version(self) -> str:
11
13
  return self._name_.lower()
12
14
 
13
15
  def prefix(self) -> str:
14
- return self._value_
16
+ return f"{self._value_}/"
15
17
 
16
18
  @staticmethod
17
- def from_arrow_info(supported_arrow_versions: list[str]) -> ArrowEndpointVersion:
18
- # If the server supports versioned endpoints, we try v1 first
19
- if ArrowEndpointVersion.V1.version() in supported_arrow_versions:
20
- return ArrowEndpointVersion.V1
19
+ def check_version_compatibility(
20
+ compatible_versions: set[ArrowEndpointVersion], arrow_client: AuthenticatedArrowClient
21
+ ) -> None:
22
+ supported_server_versions = {action.type.split("/")[0].lower() for action in arrow_client.list_actions()}
23
+ for version in compatible_versions:
24
+ if version.version() in supported_server_versions:
25
+ return
21
26
 
22
- raise UnsupportedArrowEndpointVersion(supported_arrow_versions)
27
+ raise UnsupportedArrowEndpointVersion(compatible_versions, supported_server_versions)
23
28
 
24
29
 
25
30
  class UnsupportedArrowEndpointVersion(Exception):
26
- def __init__(self, server_version: list[str]) -> None:
27
- super().__init__(self, f"Unsupported Arrow endpoint versions: {server_version}")
31
+ def __init__(self, compatible_versions: set[ArrowEndpointVersion], supported_server_versions: set[str]) -> None:
32
+ super().__init__(
33
+ self,
34
+ f"The GDS version is not supported by this client version, please update the `graphdatascience` package. Arrow versions supported by this client are: {compatible_versions}, but GDS supports: {supported_server_versions}",
35
+ )
@@ -5,7 +5,7 @@ from types import TracebackType
5
5
  from typing import Any, Type
6
6
 
7
7
  from graphdatascience.graph.graph_backend import GraphBackend
8
- from graphdatascience.procedure_surface.api.catalog.graph_info import GraphInfo
8
+ from graphdatascience.graph.graph_info import GraphInfo
9
9
 
10
10
 
11
11
  class Graph:
@@ -127,16 +127,16 @@ class Graph:
127
127
  """
128
128
  return self._backend.exists()
129
129
 
130
- def drop(self, failIfMissing: bool = True) -> GraphInfo | None:
130
+ def drop(self, fail_if_missing: bool = True) -> GraphInfo | None:
131
131
  """
132
132
  Args:
133
- failIfMissing: whether to fail if the graph does not exist
133
+ fail_if_missing: whether to fail if the graph does not exist
134
134
 
135
135
  Returns:
136
136
  the result of the drop operation
137
137
 
138
138
  """
139
- return self._backend.drop(fail_if_missing=failIfMissing)
139
+ return self._backend.drop(fail_if_missing=fail_if_missing)
140
140
 
141
141
  def creation_time(self) -> datetime:
142
142
  """
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from abc import ABC, abstractmethod
4
4
 
5
- from graphdatascience.procedure_surface.api.catalog.graph_info import GraphInfo, GraphInfoWithDegrees
5
+ from graphdatascience.graph.graph_info import GraphInfo, GraphInfoWithDegrees
6
6
 
7
7
 
8
8
  class GraphBackend(ABC):
@@ -10,7 +10,7 @@ from pandas import DataFrame, concat
10
10
  from graphdatascience.query_runner.query_mode import QueryMode
11
11
  from graphdatascience.query_runner.query_runner import QueryRunner
12
12
  from graphdatascience.query_runner.query_type import QueryType
13
- from graphdatascience.server_version.server_version import ServerVersion
13
+ from graphdatascience.versions import ServerVersion
14
14
 
15
15
  from .graph_constructor import GraphConstructor
16
16
 
@@ -87,13 +87,14 @@ class CypherGraphConstructor(GraphConstructor):
87
87
 
88
88
  def _should_warn_about_arrow_missing(self) -> bool:
89
89
  try:
90
- license: str = self._query_runner.run_retryable_cypher(
90
+ gds_license: str = self._query_runner.run_retryable_cypher( # type: ignore
91
91
  "CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value",
92
92
  QueryType.SYSTEM,
93
93
  custom_error=False,
94
94
  mode=QueryMode.READ,
95
- ).squeeze()
96
- should_warn = license == "Licensed"
95
+ ).iloc[0, 0]
96
+
97
+ should_warn = gds_license == "Licensed"
97
98
  except Exception as e:
98
99
  # It's not a user's concern whether Arrow is set up or not in AuraDS.
99
100
  if "There is no procedure with the name `gds.debug.sysInfo` registered for this database instance." in str(
@@ -18,6 +18,7 @@ from graphdatascience.procedure_surface.api.centrality.closeness_endpoints impor
18
18
  from graphdatascience.procedure_surface.api.centrality.closeness_harmonic_endpoints import ClosenessHarmonicEndpoints
19
19
  from graphdatascience.procedure_surface.api.centrality.degree_endpoints import DegreeEndpoints
20
20
  from graphdatascience.procedure_surface.api.centrality.eigenvector_endpoints import EigenvectorEndpoints
21
+ from graphdatascience.procedure_surface.api.centrality.hits_endpoints import HitsEndpoints
21
22
  from graphdatascience.procedure_surface.api.centrality.pagerank_endpoints import PageRankEndpoints
22
23
  from graphdatascience.procedure_surface.api.collapse_path_endpoints import CollapsePathEndpoints
23
24
  from graphdatascience.procedure_surface.api.community.clique_counting_endpoints import CliqueCountingEndpoints
@@ -46,6 +47,7 @@ from graphdatascience.procedure_surface.api.config_endpoints import ConfigEndpoi
46
47
  from graphdatascience.procedure_surface.api.debug_endpoints import DebugEndpoints
47
48
  from graphdatascience.procedure_surface.api.kge.kge_endpoints import KgeEndpoints
48
49
  from graphdatascience.procedure_surface.api.license_endpoints import LicenseEndpoints
50
+ from graphdatascience.procedure_surface.api.memory_endpoints import MemoryEndpoints
49
51
  from graphdatascience.procedure_surface.api.model.model_catalog_endpoints import ModelCatalogEndpoints
50
52
  from graphdatascience.procedure_surface.api.node_embedding.fastrp_endpoints import FastRPEndpoints
51
53
  from graphdatascience.procedure_surface.api.node_embedding.graphsage_endpoints import GraphSageEndpoints
@@ -53,7 +55,6 @@ from graphdatascience.procedure_surface.api.node_embedding.hashgnn_endpoints imp
53
55
  from graphdatascience.procedure_surface.api.node_embedding.node2vec_endpoints import Node2VecEndpoints
54
56
  from graphdatascience.procedure_surface.api.pathfinding.all_shortest_path_endpoints import AllShortestPathEndpoints
55
57
  from graphdatascience.procedure_surface.api.pathfinding.bfs_endpoints import BFSEndpoints
56
- from graphdatascience.procedure_surface.api.pathfinding.dag_endpoints import DagEndpoints
57
58
  from graphdatascience.procedure_surface.api.pathfinding.dfs_endpoints import DFSEndpoints
58
59
  from graphdatascience.procedure_surface.api.pathfinding.k_spanning_tree_endpoints import KSpanningTreeEndpoints
59
60
  from graphdatascience.procedure_surface.api.pathfinding.max_flow_endpoints import MaxFlowEndpoints
@@ -90,6 +91,7 @@ from graphdatascience.procedure_surface.cypher.centrality.closeness_harmonic_cyp
90
91
  )
91
92
  from graphdatascience.procedure_surface.cypher.centrality.degree_cypher_endpoints import DegreeCypherEndpoints
92
93
  from graphdatascience.procedure_surface.cypher.centrality.eigenvector_cypher_endpoints import EigenvectorCypherEndpoints
94
+ from graphdatascience.procedure_surface.cypher.centrality.hits_cypher_endpoints import HitsCypherEndpoints
93
95
  from graphdatascience.procedure_surface.cypher.centrality.pagerank_cypher_endpoints import PageRankCypherEndpoints
94
96
  from graphdatascience.procedure_surface.cypher.collapse_path_cypher_endpoints import CollapsePathCypherEndpoints
95
97
  from graphdatascience.procedure_surface.cypher.community.clique_counting_cypher_endpoints import (
@@ -125,6 +127,7 @@ from graphdatascience.procedure_surface.cypher.debug_cypher_endpoints import Deb
125
127
  from graphdatascience.procedure_surface.cypher.kge.kge_predict_cypher_endpoints import KgePredictCypherEndpoints
126
128
  from graphdatascience.procedure_surface.cypher.license_cypher_endpoints import LicenseCypherEndpoints
127
129
  from graphdatascience.procedure_surface.cypher.list_progress_cypher_endpoint import ListProgressCypherEndpoint
130
+ from graphdatascience.procedure_surface.cypher.memory_cypher_endpoints import MemoryCypherEndpoints
128
131
  from graphdatascience.procedure_surface.cypher.model.model_catalog_cypher_endpoints import (
129
132
  ModelCatalogCypherEndpoints,
130
133
  )
@@ -177,15 +180,17 @@ from graphdatascience.procedure_surface.cypher.topological_link_prediction_cyphe
177
180
  )
178
181
  from graphdatascience.procedure_surface.cypher.util_cypher_endpoints import UtilCypherEndpoints
179
182
  from graphdatascience.query_runner.query_mode import QueryMode
183
+ from graphdatascience.versions import ServerVersion
180
184
 
181
185
  from .arrow_client.arrow_authentication import UsernamePasswordAuthentication
186
+ from .arrow_client.arrow_endpoint_version import ArrowEndpointVersion
182
187
  from .arrow_client.arrow_info import ArrowInfo
183
188
  from .arrow_client.authenticated_flight_client import AuthenticatedArrowClient
184
189
  from .arrow_client.v1.gds_arrow_client import GdsArrowClient
190
+ from .query_runner.db_environment_resolver import DbEnvironmentResolver
185
191
  from .query_runner.neo4j_query_runner import Neo4jQueryRunner
186
192
  from .query_runner.query_runner import QueryRunner
187
193
  from .query_runner.query_type import QueryType
188
- from .server_version.server_version import ServerVersion
189
194
  from .version import __min_server_version__
190
195
 
191
196
 
@@ -199,7 +204,7 @@ class GraphDataScience:
199
204
  self,
200
205
  endpoint: str | Driver | QueryRunner,
201
206
  auth: tuple[str, str] | None = None,
202
- aura_ds: bool = False,
207
+ aura_ds: bool | None = None,
203
208
  database: str | None = None,
204
209
  arrow: str | bool = True,
205
210
  bookmarks: Any | None = None,
@@ -215,9 +220,10 @@ class GraphDataScience:
215
220
  The Neo4j endpoint to connect to. Most commonly, this is a Bolt connection URI.
216
221
  auth : tuple[str, str] | None, default None
217
222
  A username, password pair for database authentication.
218
- aura_ds : bool, default False
219
- A flag that indicates that that the client is used to connect
220
- to a Neo4j AuraDS instance.
223
+ aura_ds : bool | None, default None
224
+ A flag that indicates that the client is used to connect
225
+ to a Neo4j AuraDS instance. If not set, the client will
226
+ automatically derive whether the database is hosted in Aura.
221
227
  database: str | None, default None
222
228
  The Neo4j database to query against.
223
229
  arrow : str | bool, default True
@@ -234,9 +240,6 @@ class GraphDataScience:
234
240
  arrow_client_options : dict[str, Any] | None, default None
235
241
  Additional options to be passed to the Arrow Flight client.
236
242
  """
237
- if aura_ds:
238
- GraphDataScience._validate_endpoint(endpoint)
239
-
240
243
  if isinstance(endpoint, QueryRunner):
241
244
  self._query_runner = endpoint
242
245
  else:
@@ -244,6 +247,14 @@ class GraphDataScience:
244
247
  if auth:
245
248
  db_auth = neo4j.basic_auth(*auth)
246
249
 
250
+ if aura_ds is None:
251
+ # aura_ds only affects the driver config for string endpoints, so we only
252
+ # need to derive it in that case (a provided Driver is used as-is).
253
+ aura_ds = isinstance(endpoint, str) and GraphDataScience._derive_aura_ds(endpoint, db_auth, database)
254
+
255
+ if aura_ds:
256
+ GraphDataScience._validate_endpoint(endpoint)
257
+
247
258
  self._query_runner = Neo4jQueryRunner.create_for_db(
248
259
  endpoint, db_auth, aura_ds, database, bookmarks, show_progress
249
260
  )
@@ -276,15 +287,21 @@ class GraphDataScience:
276
287
  "Falling back to use Cypher for GDS. To use Arrow, you must explicitly provide the `auth` parameter."
277
288
  )
278
289
  else:
290
+ listen_address = arrow if isinstance(arrow, str) else arrow_info.listenAddress
291
+
279
292
  self._arrow_client = GdsArrowClient(
280
293
  AuthenticatedArrowClient(
281
- arrow_info.listenAddress,
294
+ listen_address,
282
295
  auth=arrow_auth,
283
296
  encrypted=self._query_runner.encrypted(),
284
297
  arrow_client_options=arrow_client_options,
285
298
  )
286
299
  )
287
300
 
301
+ ArrowEndpointVersion.check_version_compatibility(
302
+ {ArrowEndpointVersion.V1}, self._arrow_client._flight_client
303
+ )
304
+
288
305
  self._query_runner.set_show_progress(show_progress)
289
306
 
290
307
  @property
@@ -329,6 +346,13 @@ class GraphDataScience:
329
346
  """
330
347
  return DebugCypherEndpoints(self._query_runner)
331
348
 
349
+ @property
350
+ def memory(self) -> MemoryEndpoints:
351
+ """
352
+ Return memory usage endpoints.
353
+ """
354
+ return MemoryCypherEndpoints(self._query_runner)
355
+
332
356
  @property
333
357
  def list_progress(self) -> ListProgressCypherEndpoint:
334
358
  """
@@ -366,6 +390,13 @@ class GraphDataScience:
366
390
  """
367
391
  return ArticleRankCypherEndpoints(self._query_runner)
368
392
 
393
+ @property
394
+ def hits(self) -> HitsEndpoints:
395
+ """
396
+ Return endpoints for the HITS algorithm.
397
+ """
398
+ return HitsCypherEndpoints(self._query_runner)
399
+
369
400
  @property
370
401
  def bfs(self) -> BFSEndpoints:
371
402
  """
@@ -430,7 +461,7 @@ class GraphDataScience:
430
461
  return ClosenessCypherEndpoints(self._query_runner)
431
462
 
432
463
  @property
433
- def dag(self) -> DagEndpoints:
464
+ def dag(self) -> DagCypherEndpoints:
434
465
  """
435
466
  Return endpoints for Directed Acyclic Graph (DAG) algorithms.
436
467
  """
@@ -465,6 +496,7 @@ class GraphDataScience:
465
496
  return GraphSageEndpoints(
466
497
  train_endpoints=GraphSageTrainCypherEndpoints(self._query_runner),
467
498
  predict_endpoints=GraphSagePredictCypherEndpoints(self._query_runner),
499
+ catalog_endpoints=self.model,
468
500
  )
469
501
 
470
502
  @property
@@ -772,7 +804,6 @@ class GraphDataScience:
772
804
  query: str,
773
805
  params: dict[str, Any] | None = None,
774
806
  database: str | None = None,
775
- retryable: bool = False,
776
807
  mode: QueryMode = QueryMode.WRITE,
777
808
  ) -> DataFrame:
778
809
  """
@@ -786,8 +817,6 @@ class GraphDataScience:
786
817
  parameters to the query
787
818
  database: str
788
819
  the database on which to run the query
789
- retryable: bool
790
- whether the query can be automatically retried. Make sure the query is idempotent if set to True.
791
820
  mode: QueryMode
792
821
  the query mode to use (READ or WRITE). Set based on the operation performed in the query.
793
822
 
@@ -796,12 +825,9 @@ class GraphDataScience:
796
825
  """
797
826
  query_type = QueryType.USER_DIRECTED
798
827
 
799
- if retryable:
800
- return self._query_runner.run_retryable_cypher(
801
- query, query_type, params, database, custom_error=False, mode=mode
802
- )
803
- else:
804
- return self._query_runner.run_cypher(query, query_type, params, database, custom_error=False, mode=mode)
828
+ return self._query_runner.run_retryable_cypher(
829
+ query, query_type, params, database, custom_error=False, mode=mode
830
+ )
805
831
 
806
832
  def driver_config(self) -> dict[str, Any]:
807
833
  """
@@ -812,6 +838,18 @@ class GraphDataScience:
812
838
  """
813
839
  return self._query_runner.driver_config()
814
840
 
841
+ @staticmethod
842
+ def _derive_aura_ds(endpoint: str, auth: neo4j.Auth | None, database: str | None) -> bool:
843
+ # Whether a database is hosted in Aura can only be determined by connecting to it,
844
+ # so we use a temporary query runner to derive the flag from the server.
845
+ detection_runner = Neo4jQueryRunner.create_for_db(
846
+ endpoint, auth, aura_ds=False, database=database, show_progress=False
847
+ )
848
+ try:
849
+ return DbEnvironmentResolver.hosted_in_aura(detection_runner)
850
+ finally:
851
+ detection_runner.close()
852
+
815
853
  @staticmethod
816
854
  def _validate_endpoint(endpoint: str | Driver | QueryRunner) -> None:
817
855
  if isinstance(endpoint, str):
@@ -2,14 +2,19 @@ from __future__ import annotations
2
2
 
3
3
  from abc import ABC
4
4
 
5
- from graphdatascience.model.model_api import ModelApi
5
+ from graphdatascience.model.model_catalog_protocol import ModelCatalogProtocol
6
6
  from graphdatascience.model.model_details import ModelDetails
7
+ from graphdatascience.procedure_surface.api.model.model_catalog_endpoints import (
8
+ ModelDeleteResult,
9
+ ModelLoadResult,
10
+ ModelStoreResult,
11
+ )
7
12
 
8
13
 
9
14
  class Model(ABC):
10
- def __init__(self, name: str, model_api: ModelApi):
15
+ def __init__(self, name: str, catalog: ModelCatalogProtocol):
11
16
  self._name = name
12
- self._model_api = model_api
17
+ self._catalog = catalog
13
18
 
14
19
  def name(self) -> str:
15
20
  """
@@ -22,7 +27,14 @@ class Model(ABC):
22
27
  return self._name
23
28
 
24
29
  def details(self) -> ModelDetails:
25
- return self._model_api.get(self._name)
30
+ """
31
+ Get metadata about the model from the model catalog.
32
+
33
+ Returns:
34
+ The details of the model.
35
+
36
+ """
37
+ return self._catalog.get(self._name)
26
38
 
27
39
  def exists(self) -> bool:
28
40
  """
@@ -32,20 +44,66 @@ class Model(ABC):
32
44
  True if the model exists, False otherwise.
33
45
 
34
46
  """
35
- return self._model_api.exists(self._name)
47
+ return self._catalog.exists(self._name) is not None
36
48
 
37
- def drop(self, failIfMissing: bool = False) -> ModelDetails | None:
49
+ def drop(self, fail_if_missing: bool = False) -> ModelDetails | None:
38
50
  """
39
51
  Drop the model.
40
52
 
41
53
  Args:
42
- failIfMissing: If True, an error is thrown if the model does not exist. If False, no error is thrown.
54
+ fail_if_missing: If True, an error is thrown if the model does not exist. If False, no error is thrown.
43
55
 
44
56
  Returns:
45
57
  The result of the drop operation.
46
58
 
47
59
  """
48
- return self._model_api.drop(self._name, failIfMissing)
60
+ return self._catalog.drop(self._name, fail_if_missing=fail_if_missing)
61
+
62
+ def delete(self, fail_if_missing: bool = False) -> ModelDeleteResult | None:
63
+ """
64
+ Delete the persisted model from storage.
65
+
66
+ Args:
67
+ fail_if_missing: If True, an error is thrown if the model does not exist. If False, no error is thrown.
68
+
69
+ Returns:
70
+ The result of the delete operation.
71
+
72
+ """
73
+ return self._catalog.delete(self._name, fail_if_missing)
74
+
75
+ def load(self) -> ModelLoadResult:
76
+ """
77
+ Load the persisted model into the in-memory catalog.
78
+
79
+ Returns:
80
+ The result of the load operation.
81
+
82
+ """
83
+ return self._catalog.load(self._name)
84
+
85
+ def store(self, fail_if_unsupported: bool = False) -> ModelStoreResult:
86
+ """
87
+ Persist the model to storage.
88
+
89
+ Args:
90
+ fail_if_unsupported: If True, an error is thrown if the model is not supported for storing.
91
+
92
+ Returns:
93
+ The result of the store operation.
94
+
95
+ """
96
+ return self._catalog.store(self._name, fail_if_unsupported=fail_if_unsupported)
97
+
98
+ def publish(self) -> ModelDetails:
99
+ """
100
+ Publish the model so it becomes accessible to other users.
101
+
102
+ Returns:
103
+ The details of the published model.
104
+
105
+ """
106
+ return self._catalog.publish(self._name)
49
107
 
50
108
  def __str__(self) -> str:
51
109
  return f"{self.__class__.__name__}(name={self.name()}, type={self.details().model_type})"
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Protocol
4
+
5
+ from graphdatascience.model.model_details import ModelDetails
6
+ from graphdatascience.procedure_surface.api.model.model_catalog_endpoints import (
7
+ ModelDeleteResult,
8
+ ModelExistsResult,
9
+ ModelLoadResult,
10
+ ModelStoreResult,
11
+ )
12
+
13
+
14
+ class ModelCatalogProtocol(Protocol):
15
+ """The subset of model catalog operations a :class:`Model` object delegates to."""
16
+
17
+ def get(self, model_name: str) -> ModelDetails: ...
18
+
19
+ def exists(self, model_name: str) -> ModelExistsResult | None: ...
20
+
21
+ def drop(self, model_name: str, *, fail_if_missing: bool = True) -> ModelDetails | None: ...
22
+
23
+ def delete(self, model_name: str, fail_if_missing: bool = False) -> ModelDeleteResult | None: ...
24
+
25
+ def load(self, model_name: str) -> ModelLoadResult: ...
26
+
27
+ def store(self, model_name: str, *, fail_if_unsupported: bool = False) -> ModelStoreResult: ...
28
+
29
+ def publish(self, model_name: str) -> ModelDetails: ...
@@ -1,3 +0,0 @@
1
- from graphdatascience.procedure_surface.api.catalog.scaler_config import ScalerConfig
2
-
3
- __all__ = ["ScalerConfig"]
@@ -4,6 +4,6 @@ from pydantic import BaseModel
4
4
  from pydantic.alias_generators import to_camel
5
5
 
6
6
 
7
- class BaseResult(BaseModel, alias_generator=to_camel):
7
+ class BaseResult(BaseModel, alias_generator=to_camel, populate_by_name=True):
8
8
  def __getitem__(self, item: str) -> Any:
9
9
  return getattr(self, item)
@@ -1,4 +1,3 @@
1
- from graphdatascience.graph.graph_backend import GraphBackend
2
1
  from graphdatascience.procedure_surface.api.catalog.catalog_endpoints import (
3
2
  CatalogEndpoints,
4
3
  GraphFilterResult,
@@ -8,7 +7,11 @@ from graphdatascience.procedure_surface.api.catalog.catalog_endpoints import (
8
7
  RelationshipPropertySpec,
9
8
  )
10
9
  from graphdatascience.procedure_surface.api.catalog.dataset_endpoints import DatasetEndpoints
11
- from graphdatascience.procedure_surface.api.catalog.graph_info import GraphInfo, GraphInfoWithDegrees
10
+ from graphdatascience.procedure_surface.api.catalog.graph_export_endpoints import (
11
+ GraphExportCsvResult,
12
+ GraphExportEndpoints,
13
+ GraphExportResult,
14
+ )
12
15
  from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import (
13
16
  GraphSamplingEndpoints,
14
17
  GraphSamplingResult,
@@ -47,11 +50,11 @@ __all__ = [
47
50
  "Aggregation",
48
51
  "CatalogEndpoints",
49
52
  "DatasetEndpoints",
50
- "GraphBackend",
51
- "GraphInfoWithDegrees",
53
+ "GraphExportCsvResult",
54
+ "GraphExportEndpoints",
55
+ "GraphExportResult",
52
56
  "GraphFilterResult",
53
57
  "GraphGenerationStats",
54
- "GraphInfo",
55
58
  "GraphSamplingEndpoints",
56
59
  "GraphSamplingResult",
57
60
  "GraphWithFilterResult",
@@ -8,9 +8,10 @@ from pandas import DataFrame
8
8
  from pydantic import field_validator
9
9
 
10
10
  from graphdatascience.graph.graph_api import Graph
11
+ from graphdatascience.graph.graph_info import GraphInfoWithDegrees
11
12
  from graphdatascience.procedure_surface.api.base_result import BaseResult
12
13
  from graphdatascience.procedure_surface.api.catalog.dataset_endpoints import DatasetEndpoints
13
- from graphdatascience.procedure_surface.api.catalog.graph_info import GraphInfo, GraphInfoWithDegrees
14
+ from graphdatascience.procedure_surface.api.catalog.graph_export_endpoints import GraphExportEndpoints
14
15
  from graphdatascience.procedure_surface.api.catalog.graph_sampling_endpoints import GraphSamplingEndpoints
15
16
  from graphdatascience.procedure_surface.api.catalog.node_label_endpoints import NodeLabelEndpoints
16
17
  from graphdatascience.procedure_surface.api.catalog.node_properties_endpoints import NodePropertiesEndpoints
@@ -34,6 +35,22 @@ class CatalogEndpoints(ABC):
34
35
  """
35
36
  pass
36
37
 
38
+ @abstractmethod
39
+ def exists(self, graph_name: str) -> bool:
40
+ """Check if a graph exists in the catalog.
41
+
42
+ Parameters
43
+ ----------
44
+ graph_name
45
+ The name of the graph.
46
+
47
+ Returns
48
+ -------
49
+ bool
50
+ True if the graph exists, False otherwise.
51
+ """
52
+ pass
53
+
37
54
  @abstractmethod
38
55
  def construct(
39
56
  self,
@@ -102,23 +119,6 @@ class CatalogEndpoints(ABC):
102
119
  """
103
120
  pass
104
121
 
105
- @abstractmethod
106
- def drop(self, G: Graph | str, fail_if_missing: bool = True) -> GraphInfo | None:
107
- """Drop a graph from the graph catalog.
108
-
109
- Parameters
110
- ----------
111
- G
112
- Graph to drop by name of object.
113
- fail_if_missing
114
- Whether to fail if the graph is missing
115
-
116
- Returns
117
- -------
118
- GraphListResult
119
- GraphV2 metadata object containing information like node count.
120
- """
121
-
122
122
  @abstractmethod
123
123
  def filter(
124
124
  self,
@@ -224,6 +224,12 @@ class CatalogEndpoints(ABC):
224
224
  tuple of the generated graph object and the result object containing stats about the generation.
225
225
  """
226
226
 
227
+ @property
228
+ @abstractmethod
229
+ def export(self) -> GraphExportEndpoints:
230
+ """Endpoints for exporting graphs to a new database or CSV files."""
231
+ pass
232
+
227
233
  @property
228
234
  @abstractmethod
229
235
  def sample(self) -> GraphSamplingEndpoints: