File tree Expand file tree Collapse file tree
python-wrapper/src/neo4j_viz Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- """Compatibility shims for the Neo4j GDS Python client.
2-
3- Supports both the GDS 1.22 transitional API (graph operations exposed under the
4- ``gds.v2.*`` namespace, graph objects of type ``GraphV2``) and the GDS 2.0 API
5- (the v2 endpoints became the default, so they live directly under ``gds.*`` and
6- the graph class was renamed from ``GraphV2`` to ``Graph``).
7-
8- The two APIs are selected by the installed client's major version, exposed via
9- ``graphdatascience.version.__version__``: major ``>= 2`` means the v2 endpoints
10- are the default.
11- """
12-
131from __future__ import annotations
142
153import importlib
@@ -24,14 +12,8 @@ def _parse_major(version: str) -> int:
2412 return int (match .group (1 )) if match else 0
2513
2614
27- # In GDS 2.0 the (formerly ``v2``) endpoints became the default: graph operations moved
28- # from ``gds.v2.*`` to ``gds.*`` and ``GraphV2`` was renamed to ``Graph``.
2915IS_GDS_2 : bool = _parse_major (_gds_version ) >= 2
3016
31- # The native graph class for the installed client version. Resolved dynamically (typed
32- # ``Any``) because its import path differs between versions and only one path exists at a time.
33- # ``_GRAPH_TYPES`` is the full set of graph objects accepted as input to ``from_gds``: on the
34- # 1.22 transitional client we also accept the legacy v1 ``Graph`` (which is then converted).
3517if IS_GDS_2 :
3618 GdsGraph : Any = importlib .import_module ("graphdatascience.graph" ).Graph
3719 _GRAPH_TYPES : tuple [type , ...] = (GdsGraph ,)
You can’t perform that action at this time.
0 commit comments