From efb9c00a37f7f9623877b9530b1fe44a14526392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florentin=20D=C3=B6rre?= Date: Thu, 30 Oct 2025 11:32:17 +0100 Subject: [PATCH 1/3] Fix issue with including gds list properties --- changelog.md | 1 + python-wrapper/src/neo4j_viz/gds.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 982d84a9..af69f4e6 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ - fixed a bug in `from_neo4j`, where the node size would always be set to the `size` property. - fixed a bug in `from_neo4j`, where the node caption would always be set to the `caption` property. - Color nodes in `from_snowflake` only if there are less than 13 node tables used. This avoids reuse of colors for different tables. +- fixed a bug in `from_gds`, where properties of type list could not be imported. ## Improvements diff --git a/python-wrapper/src/neo4j_viz/gds.py b/python-wrapper/src/neo4j_viz/gds.py index 013f62f7..e6a399ac 100644 --- a/python-wrapper/src/neo4j_viz/gds.py +++ b/python-wrapper/src/neo4j_viz/gds.py @@ -151,7 +151,7 @@ def from_gds( if property_name is not None and property_name in df.columns: df.drop(columns=[property_name], inplace=True) - node_props_df = pd.concat(node_dfs.values(), ignore_index=True, axis=0).drop_duplicates() + node_props_df = pd.concat(node_dfs.values(), ignore_index=True, axis=0).drop_duplicates(subset=["nodeId"]) for lbl, df in node_dfs.items(): if "labels" in all_actual_node_properties: From f577e341f8ef0767576200aa663c327ab2f64ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florentin=20D=C3=B6rre?= Date: Thu, 30 Oct 2025 11:32:38 +0100 Subject: [PATCH 2/3] Add for-loop example to docs + update notebooks --- docs/source/customizing.rst | 16 +++- examples/gds-example.ipynb | 181 +++++++++++++++++++---------------- examples/neo4j-example.ipynb | 48 +++++----- 3 files changed, 137 insertions(+), 108 deletions(-) diff --git a/docs/source/customizing.rst b/docs/source/customizing.rst index 0619658c..174875e4 100644 --- a/docs/source/customizing.rst +++ b/docs/source/customizing.rst @@ -182,16 +182,28 @@ Direct modification of nodes and relationships Nodes and relationships can also be modified directly by accessing the ``nodes`` and ``relationships`` fields of an existing ``VisualizationGraph`` object. -These attributes list of all the :doc:`Nodes <./api-reference/node>` and +These fields list of all the :doc:`Nodes <./api-reference/node>` and :doc:`Relationships <./api-reference/relationship>` in the graph, respectively. -Each node and relationship has attributes that can be accessed and modified directly, as in the following example: +Each node and relationship has fields that can be accessed and modified directly, as in the following example: .. code-block:: python # VG is a VisualizationGraph object + + # Modify the first node and fifth relationship VG.nodes[0].size = 10 VG.nodes[0].properties["height"] = 170 VG.relationships[4].caption = "BUYS" + # Set the coordinates for all nodes from an existing property + for node in VG.nodes: + node.x = node.properties.get("x") + node.y = node.properties.get("y") + + # Change the caption size for all relationships + for relationship in VG.relationships: + relationship.caption_size = 15 + + Any changes made to the nodes and relationships will be reflected in the next rendering of the graph. diff --git a/examples/gds-example.ipynb b/examples/gds-example.ipynb index 17f7cffb..b8d907af 100644 --- a/examples/gds-example.ipynb +++ b/examples/gds-example.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [], "source": [ - "G = gds.graph.load_cora()" + "G = gds.graph.load_cora(graph_name=\"cora\")" ] }, { @@ -87,15 +87,13 @@ "VG = from_gds(\n", " gds,\n", " G,\n", - " size_property=\"pagerank\",\n", - " additional_node_properties=[\"componentId\", \"subject\"],\n", " max_node_count=100,\n", ")" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 30, "metadata": { "tags": [ "preserve-output" @@ -162,27 +160,27 @@ "}\n", "\n", " \n", - "
\n", + "
\n", "
\n", - " \n", - " \n", - " \n", "
\n", - "
\n", + "
\n", "
\n", "\n", " \n", @@ -377,27 +377,27 @@ "}\n", "\n", " \n", - "
\n", + "
\n", "
\n", - " \n", - " \n", - " \n", "
\n", - "
\n", + "
\n", "
\n", "\n", " \n", From 744d9a79784e7f9f4e54c80e2d79b81547ccc622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florentin=20D=C3=B6rre?= Date: Thu, 30 Oct 2025 11:33:05 +0100 Subject: [PATCH 3/3] Prepare for 0.6.0 --- changelog.md | 2 +- python-wrapper/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index af69f4e6..00538de1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -# Changes in 0.5.1 +# Changes in 0.6.0 ## Breaking changes diff --git a/python-wrapper/pyproject.toml b/python-wrapper/pyproject.toml index e8371cd6..e359051b 100644 --- a/python-wrapper/pyproject.toml +++ b/python-wrapper/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "neo4j-viz" -version = "0.5.1" +version = "0.6.0" description = "A simple graph visualization tool" readme = "README.md" authors = [{ name = "Neo4j", email = "team-gds@neo4j.org" }]