Skip to content

Make sure to drop temp internal node props in from_gds #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## Bug fixes

* Make sure that temporary internal node properties are not included in the visualization output.


## Improvements

Expand Down
4 changes: 4 additions & 0 deletions python-wrapper/src/neo4j_viz/gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def from_gds(
node_properties = [property_name]

node_dfs = _fetch_node_dfs(gds, G_fetched, node_properties, G_fetched.node_labels())
if property_name is not None:
for df in node_dfs.values():
df.drop(columns=[property_name], inplace=True)

rel_df = _fetch_rel_df(gds, G_fetched)
finally:
if G_fetched.name() != G.name():
Expand Down
3 changes: 3 additions & 0 deletions python-wrapper/tests/test_gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ def test_from_gds_sample(gds: Any) -> None:
):
VG = from_gds(gds, G)

# Make sure internal temporary properties are not present
assert set(VG.nodes[0].properties.keys()) == {"labels"}

assert len(VG.nodes) >= 9_500
assert len(VG.nodes) <= 10_500
assert len(VG.relationships) >= 9_500
Expand Down