graphdatascience 1.12a1__tar.gz → 1.13__tar.gz
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.
- {graphdatascience-1.12a1/graphdatascience.egg-info → graphdatascience-1.13}/PKG-INFO +5 -5
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/algo/algo_proc_runner.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/call_parameters.py +2 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/endpoint_suggester.py +1 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/base_graph_proc_runner.py +9 -16
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_alpha_proc_runner.py +6 -6
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_beta_proc_runner.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_cypher_runner.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_entity_ops_runner.py +35 -18
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_export_runner.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_object.py +6 -6
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_remote_project_runner.py +5 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/nx_loader.py +10 -10
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/ogb_loader.py +24 -30
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph_data_science.py +50 -7
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/link_prediction_model.py +4 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model_alpha_proc_runner.py +6 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model_proc_runner.py +4 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/node_classification_model.py +4 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/node_regression_model.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/pipeline_model.py +16 -14
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/simple_rel_embedding_model.py +4 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/lp_pipeline_create_runner.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/nc_pipeline_create_runner.py +4 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/nc_training_pipeline.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/nr_training_pipeline.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/training_pipeline.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/arrow_endpoint_version.py +2 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/arrow_graph_constructor.py +37 -30
- graphdatascience-1.13/graphdatascience/query_runner/arrow_info.py +31 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/arrow_query_runner.py +78 -104
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/cypher_graph_constructor.py +32 -33
- graphdatascience-1.13/graphdatascience/query_runner/gds_arrow_client.py +875 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/graph_constructor.py +1 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/neo4j_query_runner.py +111 -31
- graphdatascience-1.13/graphdatascience/query_runner/progress/progress_provider.py +16 -0
- graphdatascience-1.13/graphdatascience/query_runner/progress/query_progress_logger.py +90 -0
- graphdatascience-1.13/graphdatascience/query_runner/progress/query_progress_provider.py +36 -0
- graphdatascience-1.13/graphdatascience/query_runner/progress/static_progress_provider.py +27 -0
- graphdatascience-1.13/graphdatascience/query_runner/protocol/project_protocols.py +132 -0
- graphdatascience-1.13/graphdatascience/query_runner/protocol/status.py +7 -0
- graphdatascience-1.13/graphdatascience/query_runner/protocol/write_protocols.py +134 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/query_runner.py +9 -5
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/session_query_runner.py +43 -114
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/aura_api.py +68 -25
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/aura_api_responses.py +51 -36
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/aura_graph_data_science.py +38 -16
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/cloud_location.py +1 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/dbms/protocol_resolver.py +5 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/dbms/protocol_version.py +1 -6
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/dbms_connection_info.py +3 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/dedicated_sessions.py +55 -81
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/gds_sessions.py +16 -4
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/session_info.py +4 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/session_sizes.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/system/config_endpoints.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/system/system_endpoints.py +15 -0
- graphdatascience-1.13/graphdatascience/topological_lp/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/topological_lp/topological_lp_alpha_runner.py +2 -2
- graphdatascience-1.13/graphdatascience/utils/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/utils/direct_util_endpoints.py +3 -3
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/utils/util_proc_runner.py +2 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/utils/util_remote_proc_runner.py +2 -2
- graphdatascience-1.13/graphdatascience/version.py +2 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13/graphdatascience.egg-info}/PKG-INFO +5 -5
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience.egg-info/SOURCES.txt +10 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience.egg-info/requires.txt +3 -2
- {graphdatascience-1.12a1 → graphdatascience-1.13}/pyproject.toml +1 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/requirements/base/base.txt +2 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/requirements/base/rust-ext.txt +1 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/setup.py +1 -2
- graphdatascience-1.12a1/graphdatascience/query_runner/gds_arrow_client.py +0 -254
- graphdatascience-1.12a1/graphdatascience/query_runner/query_progress_logger.py +0 -98
- graphdatascience-1.12a1/graphdatascience/version.py +0 -1
- {graphdatascience-1.12a1 → graphdatascience-1.13}/LICENSE +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/MANIFEST.in +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/README.md +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/algo/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/algo/algo_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/algo/single_mode_algo_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/call_builder.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/caller_base.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/client_only_endpoint.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/cypher_warning_handler.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/gds_not_installed.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/illegal_attr_checker.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/unable_to_connect.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/uncallable_namespace.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_create_result.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_project_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_remote_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_sample_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_type_check.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/ignored_server_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/graphsage_model.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model_beta_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/model/model_resolver.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/classification_training_pipeline.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/lp_training_pipeline.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/nr_pipeline_create_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/pipeline_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/pipeline/pipeline_proc_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/py.typed +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/query_runner/__init__.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/resources → graphdatascience-1.13/graphdatascience/query_runner/progress}/__init__.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/resources/cora → graphdatascience-1.13/graphdatascience/query_runner/protocol}/__init__.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/resources/imdb → graphdatascience-1.13/graphdatascience/resources}/__init__.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/resources/karate → graphdatascience-1.13/graphdatascience/resources/cora}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/cora/cora_nodes.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/cora/cora_rels.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/cora/serialize_cora.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/resources/lastfm → graphdatascience-1.13/graphdatascience/resources/imdb}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_acted_in.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_actors.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_directed_in.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_directors.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_movies_with_genre.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/imdb_movies_without_genre.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/imdb/serialize_imdb.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/server_version → graphdatascience-1.13/graphdatascience/resources/karate}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/karate/karate_club.parquet.gzip +0 -0
- {graphdatascience-1.12a1/graphdatascience/session/dbms → graphdatascience-1.13/graphdatascience/resources/lastfm}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/artist_nodes.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/serialize_lastfm.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/user_friend_df_directed.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/user_listen_artist_rels.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/user_nodes.parquet.gzip +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/resources/lastfm/user_tag_artist_rels.parquet.gzip +0 -0
- {graphdatascience-1.12a1/graphdatascience/system → graphdatascience-1.13/graphdatascience/server_version}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/server_version/compatible_with.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/server_version/server_version.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/algorithm_category.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/aurads_sessions.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/topological_lp → graphdatascience-1.13/graphdatascience/session/dbms}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/session/region_suggester.py +0 -0
- {graphdatascience-1.12a1/graphdatascience/utils → graphdatascience-1.13/graphdatascience/system}/__init__.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/topological_lp/topological_lp_endpoints.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/utils/util_node_property_func_runner.py +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience.egg-info/dependency_links.txt +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience.egg-info/not-zip-safe +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience.egg-info/top_level.txt +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/requirements/base/networkx.txt +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/requirements/base/ogb.txt +0 -0
- {graphdatascience-1.12a1 → graphdatascience-1.13}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: graphdatascience
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.13
|
|
4
4
|
Summary: A Python client for the Neo4j Graph Data Science (GDS) library
|
|
5
5
|
Home-page: https://neo4j.com/product/graph-data-science/
|
|
6
6
|
Author: Neo4j
|
|
@@ -16,7 +16,6 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -25,24 +24,25 @@ Classifier: Topic :: Database
|
|
|
25
24
|
Classifier: Topic :: Scientific/Engineering
|
|
26
25
|
Classifier: Topic :: Software Development
|
|
27
26
|
Classifier: Typing :: Typed
|
|
28
|
-
Requires-Python: >=3.
|
|
27
|
+
Requires-Python: >=3.9
|
|
29
28
|
Description-Content-Type: text/markdown
|
|
30
29
|
License-File: LICENSE
|
|
31
30
|
Requires-Dist: multimethod<2.0,>=1.0
|
|
32
31
|
Requires-Dist: neo4j<6.0,>=4.4.12
|
|
33
32
|
Requires-Dist: numpy<2.0
|
|
34
33
|
Requires-Dist: pandas<3.0,>=1.0
|
|
35
|
-
Requires-Dist: pyarrow<
|
|
34
|
+
Requires-Dist: pyarrow<19.0,>=15.0.2
|
|
36
35
|
Requires-Dist: textdistance<5.0,>=4.0
|
|
37
36
|
Requires-Dist: tqdm<5.0,>=4.0
|
|
38
37
|
Requires-Dist: typing-extensions<5.0,>=4.0
|
|
39
38
|
Requires-Dist: requests
|
|
39
|
+
Requires-Dist: tenacity>=9.0
|
|
40
40
|
Provides-Extra: ogb
|
|
41
41
|
Requires-Dist: ogb<2.0,>=1.0; extra == "ogb"
|
|
42
42
|
Provides-Extra: networkx
|
|
43
43
|
Requires-Dist: networkx<4.0,>=2.0; extra == "networkx"
|
|
44
44
|
Provides-Extra: rust-ext
|
|
45
|
-
Requires-Dist: neo4j-rust-ext<6.0,>=4.4.
|
|
45
|
+
Requires-Dist: neo4j-rust-ext<6.0,>=4.4.12; extra == "rust-ext"
|
|
46
46
|
|
|
47
47
|
# Neo4j Graph Data Science Client
|
|
48
48
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import ABC
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from pandas import DataFrame, Series
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ from ..model.graphsage_model import GraphSageModel
|
|
|
12
12
|
|
|
13
13
|
class AlgoProcRunner(IllegalAttrChecker, ABC):
|
|
14
14
|
@graph_type_check
|
|
15
|
-
def _run_procedure(self, G: Graph, config:
|
|
15
|
+
def _run_procedure(self, G: Graph, config: dict[str, Any], with_logging: bool = True) -> DataFrame:
|
|
16
16
|
params = CallParameters(graph_name=G.name(), config=config)
|
|
17
17
|
|
|
18
18
|
return self._query_runner.call_procedure(endpoint=self._namespace, params=params, logging=with_logging)
|
|
@@ -35,7 +35,7 @@ class StandardModeRunner(AlgoProcRunner):
|
|
|
35
35
|
|
|
36
36
|
class GraphSageRunner(AlgoProcRunner):
|
|
37
37
|
@graph_type_check
|
|
38
|
-
def __call__(self, G: Graph, **config: Any) ->
|
|
38
|
+
def __call__(self, G: Graph, **config: Any) -> tuple[GraphSageModel, "Series[Any]"]:
|
|
39
39
|
result = self._run_procedure(G, config).squeeze()
|
|
40
40
|
model_name = result["modelInfo"]["modelName"]
|
|
41
41
|
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/error/endpoint_suggester.py
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
1
|
import textdistance
|
|
4
2
|
|
|
5
3
|
from ..ignored_server_endpoints import IGNORED_SERVER_ENDPOINTS
|
|
6
4
|
|
|
7
5
|
|
|
8
|
-
def generate_suggestive_error_message(requested_endpoint: str, all_endpoints:
|
|
6
|
+
def generate_suggestive_error_message(requested_endpoint: str, all_endpoints: list[str]) -> str:
|
|
9
7
|
MIN_SIMILARITY_FOR_SUGGESTION = 0.9
|
|
10
8
|
|
|
11
9
|
closest_endpoint = None
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/base_graph_proc_runner.py
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pathlib
|
|
3
|
-
import sys
|
|
4
3
|
import warnings
|
|
5
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, List, Optional, Union
|
|
6
5
|
|
|
7
6
|
import pandas as pd
|
|
8
7
|
from multimethod import multimethod
|
|
@@ -53,28 +52,22 @@ class BaseGraphProcRunner(UncallableNamespace, IllegalAttrChecker):
|
|
|
53
52
|
|
|
54
53
|
@staticmethod
|
|
55
54
|
def _path(package: str, resource: str) -> pathlib.Path:
|
|
56
|
-
|
|
57
|
-
from importlib.resources import files
|
|
55
|
+
from importlib.resources import files
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
else:
|
|
62
|
-
from importlib.resources import path
|
|
63
|
-
|
|
64
|
-
# we dont want to use a context manager here, so we need to call __enter__ manually
|
|
65
|
-
return path(package, resource).__enter__()
|
|
57
|
+
# files() returns a Traversable, but usages require a Path object
|
|
58
|
+
return pathlib.Path(str(files(package) / resource))
|
|
66
59
|
|
|
67
60
|
@client_only_endpoint("gds.graph")
|
|
68
61
|
@compatible_with("construct", min_inclusive=ServerVersion(2, 1, 0))
|
|
69
62
|
def construct(
|
|
70
63
|
self,
|
|
71
64
|
graph_name: str,
|
|
72
|
-
nodes: Union[DataFrame,
|
|
73
|
-
relationships: Optional[Union[DataFrame,
|
|
65
|
+
nodes: Union[DataFrame, list[DataFrame]],
|
|
66
|
+
relationships: Optional[Union[DataFrame, list[DataFrame]]] = None,
|
|
74
67
|
concurrency: int = 4,
|
|
75
|
-
undirected_relationship_types: Optional[
|
|
68
|
+
undirected_relationship_types: Optional[list[str]] = None,
|
|
76
69
|
) -> Graph:
|
|
77
|
-
nodes = nodes if isinstance(nodes,
|
|
70
|
+
nodes = nodes if isinstance(nodes, list) else [nodes]
|
|
78
71
|
|
|
79
72
|
if isinstance(relationships, DataFrame):
|
|
80
73
|
relationships = [relationships]
|
|
@@ -365,7 +358,7 @@ class BaseGraphProcRunner(UncallableNamespace, IllegalAttrChecker):
|
|
|
365
358
|
G: Graph,
|
|
366
359
|
properties: Strings,
|
|
367
360
|
entities: Strings,
|
|
368
|
-
config:
|
|
361
|
+
config: dict[str, Any],
|
|
369
362
|
) -> DataFrame:
|
|
370
363
|
params = CallParameters(
|
|
371
364
|
graph_name=G.name(),
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_alpha_proc_runner.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Optional, Union
|
|
3
3
|
|
|
4
4
|
from pandas import DataFrame
|
|
5
5
|
|
|
@@ -36,13 +36,13 @@ class GraphAlphaProcRunner(UncallableNamespace, IllegalAttrChecker):
|
|
|
36
36
|
def construct(
|
|
37
37
|
self,
|
|
38
38
|
graph_name: str,
|
|
39
|
-
nodes: Union[DataFrame,
|
|
40
|
-
relationships: Union[DataFrame,
|
|
39
|
+
nodes: Union[DataFrame, list[DataFrame]],
|
|
40
|
+
relationships: Union[DataFrame, list[DataFrame]],
|
|
41
41
|
concurrency: int = 4,
|
|
42
|
-
undirected_relationship_types: Optional[
|
|
42
|
+
undirected_relationship_types: Optional[list[str]] = None,
|
|
43
43
|
) -> Graph:
|
|
44
|
-
nodes = nodes if isinstance(nodes,
|
|
45
|
-
relationships = relationships if isinstance(relationships,
|
|
44
|
+
nodes = nodes if isinstance(nodes, list) else [nodes]
|
|
45
|
+
relationships = relationships if isinstance(relationships, list) else [relationships]
|
|
46
46
|
|
|
47
47
|
errors = []
|
|
48
48
|
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_beta_proc_runner.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any,
|
|
1
|
+
from typing import Any, Union
|
|
2
2
|
|
|
3
3
|
from ..call_parameters import CallParameters
|
|
4
4
|
from ..error.illegal_attr_checker import IllegalAttrChecker
|
|
@@ -9,7 +9,7 @@ from .graph_export_runner import GraphExportCsvEndpoints
|
|
|
9
9
|
from .graph_object import Graph
|
|
10
10
|
from .graph_project_runner import GraphProjectBetaRunner
|
|
11
11
|
|
|
12
|
-
Strings = Union[str,
|
|
12
|
+
Strings = Union[str, list[str]]
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class GraphBetaProcRunner(UncallableNamespace, IllegalAttrChecker):
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_cypher_runner.py
RENAMED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from itertools import chain, zip_longest
|
|
5
|
-
from typing import Any,
|
|
5
|
+
from typing import Any, Optional
|
|
6
6
|
|
|
7
7
|
from pandas import Series
|
|
8
8
|
|
|
@@ -45,7 +45,7 @@ class GraphCypherRunner(CallerBase):
|
|
|
45
45
|
|
|
46
46
|
GraphCypherRunner._verify_query_ends_with_return_clause(self._namespace, query)
|
|
47
47
|
|
|
48
|
-
result: Optional[
|
|
48
|
+
result: Optional[dict[str, Any]] = self._query_runner.run_cypher(query, params, database, False).squeeze()
|
|
49
49
|
|
|
50
50
|
if not result:
|
|
51
51
|
raise ValueError("Projected graph cannot be empty.")
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_entity_ops_runner.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from functools import reduce
|
|
2
|
-
from typing import Any,
|
|
2
|
+
from typing import Any, Type, Union
|
|
3
3
|
from warnings import filterwarnings
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
@@ -18,7 +18,7 @@ from ..utils.util_proc_runner import UtilProcRunner
|
|
|
18
18
|
from .graph_object import Graph
|
|
19
19
|
from .graph_type_check import graph_type_check
|
|
20
20
|
|
|
21
|
-
Strings = Union[str,
|
|
21
|
+
Strings = Union[str, list[str]]
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class TopologyDataFrame(DataFrame):
|
|
@@ -26,7 +26,7 @@ class TopologyDataFrame(DataFrame):
|
|
|
26
26
|
def _constructor(self) -> "Type[TopologyDataFrame]":
|
|
27
27
|
return TopologyDataFrame
|
|
28
28
|
|
|
29
|
-
def by_rel_type(self) ->
|
|
29
|
+
def by_rel_type(self) -> dict[str, list[list[int]]]:
|
|
30
30
|
# Pandas 2.2.0 deprecated an internal API used by DF.take(indices)
|
|
31
31
|
filterwarnings(
|
|
32
32
|
"ignore",
|
|
@@ -38,7 +38,7 @@ class TopologyDataFrame(DataFrame):
|
|
|
38
38
|
|
|
39
39
|
output = {}
|
|
40
40
|
for rel_type, indices in gb.groups.items():
|
|
41
|
-
one_rel_df = self.take(indices)
|
|
41
|
+
one_rel_df = self.take(list(indices))
|
|
42
42
|
output[str(rel_type)] = [list(one_rel_df["sourceNodeId"]), list(one_rel_df["targetNodeId"])]
|
|
43
43
|
|
|
44
44
|
return output
|
|
@@ -55,7 +55,7 @@ class GraphEntityOpsBaseRunner(UncallableNamespace, IllegalAttrChecker):
|
|
|
55
55
|
G: Graph,
|
|
56
56
|
properties: Strings,
|
|
57
57
|
entities: Strings,
|
|
58
|
-
config:
|
|
58
|
+
config: dict[str, Any],
|
|
59
59
|
) -> DataFrame:
|
|
60
60
|
params = CallParameters(
|
|
61
61
|
graph_name=G.name(),
|
|
@@ -78,11 +78,16 @@ class GraphNodePropertyRunner(GraphEntityOpsBaseRunner):
|
|
|
78
78
|
G: Graph,
|
|
79
79
|
node_property: str,
|
|
80
80
|
node_labels: Strings = ["*"],
|
|
81
|
-
db_node_properties:
|
|
81
|
+
db_node_properties: list[str] = [],
|
|
82
82
|
**config: Any,
|
|
83
83
|
) -> DataFrame:
|
|
84
84
|
self._namespace += ".stream"
|
|
85
85
|
|
|
86
|
+
if len(set(db_node_properties)) != len(db_node_properties):
|
|
87
|
+
raise ValueError(
|
|
88
|
+
f"The provided db_node_properties contain duplicate property names: `{db_node_properties}`."
|
|
89
|
+
)
|
|
90
|
+
|
|
86
91
|
result = self._handle_properties(G, node_property, node_labels, config)
|
|
87
92
|
|
|
88
93
|
return GraphNodePropertiesRunner._process_result(
|
|
@@ -96,14 +101,22 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
96
101
|
def stream(
|
|
97
102
|
self,
|
|
98
103
|
G: Graph,
|
|
99
|
-
node_properties:
|
|
104
|
+
node_properties: list[str],
|
|
100
105
|
node_labels: Strings = ["*"],
|
|
101
106
|
separate_property_columns: bool = False,
|
|
102
|
-
db_node_properties:
|
|
107
|
+
db_node_properties: list[str] = [],
|
|
103
108
|
**config: Any,
|
|
104
109
|
) -> DataFrame:
|
|
105
110
|
self._namespace += ".stream"
|
|
106
111
|
|
|
112
|
+
# find if list contain duplicates
|
|
113
|
+
if len(set(node_properties)) != len(node_properties):
|
|
114
|
+
raise ValueError(f"The provided node_properties contain duplicate property names: `{node_properties}`.")
|
|
115
|
+
if len(set(db_node_properties)) != len(db_node_properties):
|
|
116
|
+
raise ValueError(
|
|
117
|
+
f"The provided db_node_properties contain duplicate property names: `{db_node_properties}`."
|
|
118
|
+
)
|
|
119
|
+
|
|
107
120
|
result = self._handle_properties(G, node_properties, node_labels, config)
|
|
108
121
|
|
|
109
122
|
return GraphNodePropertiesRunner._process_result(
|
|
@@ -113,11 +126,11 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
113
126
|
@staticmethod
|
|
114
127
|
def _process_result(
|
|
115
128
|
query_runner: QueryRunner,
|
|
116
|
-
node_properties:
|
|
129
|
+
node_properties: list[str],
|
|
117
130
|
separate_property_columns: bool,
|
|
118
|
-
db_node_properties:
|
|
131
|
+
db_node_properties: list[str],
|
|
119
132
|
result: DataFrame,
|
|
120
|
-
config:
|
|
133
|
+
config: dict[str, Any],
|
|
121
134
|
) -> DataFrame:
|
|
122
135
|
# new format was requested, but the query was run via Cypher
|
|
123
136
|
if separate_property_columns and "propertyValue" in result.keys():
|
|
@@ -125,7 +138,11 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
125
138
|
if "listNodeLabels" in config.keys():
|
|
126
139
|
# nodeLabels cannot be an index column of the pivot as its not hashable
|
|
127
140
|
# so we need to manually join it back in
|
|
128
|
-
labels_df = result[["nodeId", "nodeLabels"]]
|
|
141
|
+
labels_df = result[["nodeId", "nodeLabels"]]
|
|
142
|
+
# drop duplicates as for each property we would have one row for each nodeId
|
|
143
|
+
labels_df = labels_df.drop_duplicates(ignore_index=False, subset=["nodeId"])
|
|
144
|
+
labels_df.set_index("nodeId", inplace=True)
|
|
145
|
+
|
|
129
146
|
wide_result = wide_result.join(labels_df, on="nodeId")
|
|
130
147
|
result = wide_result.reset_index()
|
|
131
148
|
result.columns.name = None
|
|
@@ -161,7 +178,7 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
161
178
|
return result
|
|
162
179
|
|
|
163
180
|
@staticmethod
|
|
164
|
-
def _build_query(db_node_properties:
|
|
181
|
+
def _build_query(db_node_properties: list[str]) -> str:
|
|
165
182
|
query_prefix = "MATCH (n) WHERE id(n) IN $ids RETURN id(n) AS nodeId"
|
|
166
183
|
|
|
167
184
|
def add_property(query: str, prop: str) -> str:
|
|
@@ -176,7 +193,7 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
176
193
|
|
|
177
194
|
@compatible_with("drop", min_inclusive=ServerVersion(2, 2, 0))
|
|
178
195
|
@graph_type_check
|
|
179
|
-
def drop(self, G: Graph, node_properties:
|
|
196
|
+
def drop(self, G: Graph, node_properties: list[str], **config: Any) -> "Series[Any]":
|
|
180
197
|
self._namespace += ".drop"
|
|
181
198
|
params = CallParameters(
|
|
182
199
|
graph_name=G.name(),
|
|
@@ -205,7 +222,7 @@ class GraphRelationshipPropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
205
222
|
def stream(
|
|
206
223
|
self,
|
|
207
224
|
G: Graph,
|
|
208
|
-
relationship_properties:
|
|
225
|
+
relationship_properties: list[str],
|
|
209
226
|
relationship_types: Strings = ["*"],
|
|
210
227
|
separate_property_columns: bool = False,
|
|
211
228
|
**config: Any,
|
|
@@ -239,7 +256,7 @@ class GraphRelationshipPropertiesRunner(GraphEntityOpsBaseRunner):
|
|
|
239
256
|
self,
|
|
240
257
|
G: Graph,
|
|
241
258
|
relationship_type: str,
|
|
242
|
-
relationship_properties:
|
|
259
|
+
relationship_properties: list[str],
|
|
243
260
|
**config: Any,
|
|
244
261
|
) -> "Series[Any]":
|
|
245
262
|
self._namespace += ".write"
|
|
@@ -319,7 +336,7 @@ class GraphRelationshipsRunner(GraphEntityOpsBaseRunner):
|
|
|
319
336
|
|
|
320
337
|
@compatible_with("stream", min_inclusive=ServerVersion(2, 5, 0))
|
|
321
338
|
@graph_type_check
|
|
322
|
-
def stream(self, G: Graph, relationship_types:
|
|
339
|
+
def stream(self, G: Graph, relationship_types: list[str] = ["*"], **config: Any) -> TopologyDataFrame:
|
|
323
340
|
self._namespace += ".stream"
|
|
324
341
|
params = CallParameters(graph_name=G.name(), relationship_types=relationship_types, config=config)
|
|
325
342
|
result = self._query_runner.call_procedure(endpoint=self._namespace, params=params)
|
|
@@ -336,7 +353,7 @@ class GraphRelationshipsRunner(GraphEntityOpsBaseRunner):
|
|
|
336
353
|
class GraphRelationshipsBetaRunner(GraphEntityOpsBaseRunner):
|
|
337
354
|
@compatible_with("stream", min_inclusive=ServerVersion(2, 2, 0))
|
|
338
355
|
@graph_type_check
|
|
339
|
-
def stream(self, G: Graph, relationship_types:
|
|
356
|
+
def stream(self, G: Graph, relationship_types: list[str] = ["*"], **config: Any) -> TopologyDataFrame:
|
|
340
357
|
self._namespace += ".stream"
|
|
341
358
|
params = CallParameters(graph_name=G.name(), relationship_types=relationship_types, config=config)
|
|
342
359
|
|
{graphdatascience-1.12a1 → graphdatascience-1.13}/graphdatascience/graph/graph_export_runner.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
from pandas import Series
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ class GraphExportCsvRunner(IllegalAttrChecker):
|
|
|
15
15
|
return self._export_call(G, config)
|
|
16
16
|
|
|
17
17
|
@graph_type_check
|
|
18
|
-
def _export_call(self, G: Graph, config:
|
|
18
|
+
def _export_call(self, G: Graph, config: dict[str, Any]) -> "Series[Any]":
|
|
19
19
|
params = CallParameters(graph_name=G.name(), config=config)
|
|
20
20
|
return self._query_runner.call_procedure(endpoint=self._namespace, params=params).squeeze() # type: ignore
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ class GraphExportRunner(IllegalAttrChecker):
|
|
|
39
39
|
return self._export_call(G, config)
|
|
40
40
|
|
|
41
41
|
@graph_type_check
|
|
42
|
-
def _export_call(self, G: Graph, config:
|
|
42
|
+
def _export_call(self, G: Graph, config: dict[str, Any]) -> "Series[Any]":
|
|
43
43
|
params = CallParameters(graph_name=G.name(), config=config)
|
|
44
44
|
return self._query_runner.call_procedure(endpoint=self._namespace, params=params).squeeze() # type: ignore
|
|
45
45
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from types import TracebackType
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, Optional, Type, Union
|
|
5
5
|
|
|
6
6
|
from pandas import Series
|
|
7
7
|
|
|
@@ -39,7 +39,7 @@ class Graph:
|
|
|
39
39
|
"""
|
|
40
40
|
return self._name
|
|
41
41
|
|
|
42
|
-
def _graph_info(self, yields:
|
|
42
|
+
def _graph_info(self, yields: list[str] = []) -> Series[Any]:
|
|
43
43
|
yield_db = "database" in yields
|
|
44
44
|
yields_with_db = yields if yield_db else yields + ["database"]
|
|
45
45
|
|
|
@@ -90,21 +90,21 @@ class Graph:
|
|
|
90
90
|
"""
|
|
91
91
|
return self._graph_info(["relationshipCount"]) # type: ignore
|
|
92
92
|
|
|
93
|
-
def node_labels(self) ->
|
|
93
|
+
def node_labels(self) -> list[str]:
|
|
94
94
|
"""
|
|
95
95
|
Returns:
|
|
96
96
|
the node labels in the graph
|
|
97
97
|
"""
|
|
98
98
|
return list(self._graph_info(["schema"])["nodes"].keys())
|
|
99
99
|
|
|
100
|
-
def relationship_types(self) ->
|
|
100
|
+
def relationship_types(self) -> list[str]:
|
|
101
101
|
"""
|
|
102
102
|
Returns:
|
|
103
103
|
the relationship types in the graph
|
|
104
104
|
"""
|
|
105
105
|
return list(self._graph_info(["schema"])["relationships"].keys())
|
|
106
106
|
|
|
107
|
-
def node_properties(self, label: Optional[str] = None) -> Union[
|
|
107
|
+
def node_properties(self, label: Optional[str] = None) -> Union[Series[str], list[str]]:
|
|
108
108
|
"""
|
|
109
109
|
Args:
|
|
110
110
|
label: the node label to get the properties for
|
|
@@ -123,7 +123,7 @@ class Graph:
|
|
|
123
123
|
|
|
124
124
|
return list(labels_to_props[label].keys())
|
|
125
125
|
|
|
126
|
-
def relationship_properties(self, type: Optional[str] = None) -> Union[
|
|
126
|
+
def relationship_properties(self, type: Optional[str] = None) -> Union[Series[str], list[str]]:
|
|
127
127
|
"""
|
|
128
128
|
Args:
|
|
129
129
|
type: the relationship type to get the properties for
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
|
|
5
5
|
from ..call_parameters import CallParameters
|
|
6
6
|
from ..error.illegal_attr_checker import IllegalAttrChecker
|
|
@@ -17,9 +17,10 @@ class GraphProjectRemoteRunner(IllegalAttrChecker):
|
|
|
17
17
|
self,
|
|
18
18
|
graph_name: str,
|
|
19
19
|
query: str,
|
|
20
|
+
job_id: Optional[str] = None,
|
|
20
21
|
concurrency: int = 4,
|
|
21
|
-
undirected_relationship_types: Optional[
|
|
22
|
-
inverse_indexed_relationship_types: Optional[
|
|
22
|
+
undirected_relationship_types: Optional[list[str]] = None,
|
|
23
|
+
inverse_indexed_relationship_types: Optional[list[str]] = None,
|
|
23
24
|
batch_size: Optional[int] = None,
|
|
24
25
|
) -> GraphCreateResult:
|
|
25
26
|
if inverse_indexed_relationship_types is None:
|
|
@@ -34,6 +35,7 @@ class GraphProjectRemoteRunner(IllegalAttrChecker):
|
|
|
34
35
|
params = CallParameters(
|
|
35
36
|
graph_name=graph_name,
|
|
36
37
|
query=query,
|
|
38
|
+
job_id=job_id,
|
|
37
39
|
concurrency=concurrency,
|
|
38
40
|
undirected_relationship_types=undirected_relationship_types,
|
|
39
41
|
inverse_indexed_relationship_types=inverse_indexed_relationship_types,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
|
-
from typing import Any,
|
|
2
|
+
from typing import Any, Optional
|
|
3
3
|
|
|
4
4
|
import networkx as nx
|
|
5
5
|
from pandas import DataFrame
|
|
@@ -28,8 +28,8 @@ class NXLoader(UncallableNamespace, IllegalAttrChecker):
|
|
|
28
28
|
return Graph(graph_name, self._query_runner)
|
|
29
29
|
|
|
30
30
|
@staticmethod
|
|
31
|
-
def _attr_to_labels_key(labels_attr: Any, node_id: Any, no_node_labels: Optional[bool]) ->
|
|
32
|
-
node_labels:
|
|
31
|
+
def _attr_to_labels_key(labels_attr: Any, node_id: Any, no_node_labels: Optional[bool]) -> tuple[str, ...]:
|
|
32
|
+
node_labels: list[str]
|
|
33
33
|
if no_node_labels:
|
|
34
34
|
node_labels = ["N"]
|
|
35
35
|
elif isinstance(labels_attr, str):
|
|
@@ -45,9 +45,9 @@ class NXLoader(UncallableNamespace, IllegalAttrChecker):
|
|
|
45
45
|
return tuple(sorted(node_labels))
|
|
46
46
|
|
|
47
47
|
@staticmethod
|
|
48
|
-
def _parse_nodes(nx_G: nx.Graph) ->
|
|
49
|
-
node_dicts_by_labels:
|
|
50
|
-
node_props_schema:
|
|
48
|
+
def _parse_nodes(nx_G: nx.Graph) -> list[DataFrame]:
|
|
49
|
+
node_dicts_by_labels: dict[tuple[str, ...], dict[str, list[Any]]] = defaultdict(lambda: defaultdict(list))
|
|
50
|
+
node_props_schema: dict[tuple[str, ...], set[str]] = defaultdict(set)
|
|
51
51
|
|
|
52
52
|
no_node_labels = None
|
|
53
53
|
|
|
@@ -84,9 +84,9 @@ class NXLoader(UncallableNamespace, IllegalAttrChecker):
|
|
|
84
84
|
return "R" if type_attr is None else type_attr
|
|
85
85
|
|
|
86
86
|
@staticmethod
|
|
87
|
-
def _parse_rels(nx_G: nx.Graph) ->
|
|
88
|
-
rel_dicts_by_types:
|
|
89
|
-
rel_props_schema:
|
|
87
|
+
def _parse_rels(nx_G: nx.Graph) -> list[DataFrame]:
|
|
88
|
+
rel_dicts_by_types: dict[str, dict[str, list[Any]]] = defaultdict(lambda: defaultdict(list))
|
|
89
|
+
rel_props_schema: dict[str, set[str]] = defaultdict(set)
|
|
90
90
|
no_rel_types = None
|
|
91
91
|
|
|
92
92
|
for edge_data in nx_G.edges(data=True):
|
|
@@ -129,7 +129,7 @@ class NXLoader(UncallableNamespace, IllegalAttrChecker):
|
|
|
129
129
|
]
|
|
130
130
|
|
|
131
131
|
@staticmethod
|
|
132
|
-
def _parse(nx_G: nx.Graph) ->
|
|
132
|
+
def _parse(nx_G: nx.Graph) -> tuple[list[DataFrame], list[DataFrame]]:
|
|
133
133
|
nodes = NXLoader._parse_nodes(nx_G)
|
|
134
134
|
rels = NXLoader._parse_rels(nx_G)
|
|
135
135
|
|