Skip to content

Allow entities with different property sets in from_gds loader#189

Merged
FlorentinD merged 4 commits intomainfrom
from_gds-hetero
Jul 1, 2025
Merged

Allow entities with different property sets in from_gds loader#189
FlorentinD merged 4 commits intomainfrom
from_gds-hetero

Conversation

@adamnsch
Copy link
Collaborator

@adamnsch adamnsch commented Jun 27, 2025

Thank you for your contribution to the Graph Visualization for Python project by Neo4j.

Before submitting this PR, please read Contributing to the Neo4j Ecosystem.

Make sure:

  • You signed the Neo4j CLA (Contributor License Agreement) so that we are allowed to ship your code in our library
  • Your contribution is covered by tests

Based on #188

@adamnsch adamnsch mentioned this pull request Jun 27, 2025
2 tasks
@@ -79,24 +79,31 @@ def from_gds(
"""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also allow additional_node_properties to be given as a dict: label -> properties, and similarly size_property as dict: label -> property?
It would make things even more heterogeneous-native I think. But something for another PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think there is a tradeoff in how difficult the api looks for first-users.
I think for such cases, you could always modify the visualization graph after initial import

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 👍

has_size &= "size" in node_df.columns
for _, row in node_df.iterrows():
if dropna:
row.dropna(inplace=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably should not be inplace actually

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not?

as mentioned in the other PR, you could also just skip the entry in the k,v loop below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not?

Since I don't think we want to modify the dataframes the user gives us, right?

as mentioned in the other PR, you could also just skip the entry in the k,v loop below

I think it's bit cleaner to do it like this :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right in pandas they come from the user. was mainly thinking from_gds here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inplace=False now

Co-Authored-By: Florentin Dörre <florentin.dorre@neotechnology.com>
@adamnsch
Copy link
Collaborator Author

adamnsch commented Jul 1, 2025

Removed the dropna param from the external from_dfs signature now


# setting as environment variables to run notebooks with this connection
os.environ["NEO4J_URI"] = dbms_connection_info.uri
assert isinstance(dbms_connection_info.username, str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right latest gds release changed this.
There is dbms_connection_info.get_auth(), but thats not useful here to set an env variable

@FlorentinD FlorentinD merged commit e6ffd44 into main Jul 1, 2025
10 checks passed
@adamnsch adamnsch deleted the from_gds-hetero branch July 1, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants