-
Notifications
You must be signed in to change notification settings - Fork 46
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
Get a dataframe of nodeId and nodeLabel in absence of any other node properties #666
Comments
Hi @Hossein-Tohidi, Thank you for the feature request. We are aware of this limitation, and there will likely be a new feature that will let you do what you're asking before too long. Until then, would you perhaps be able to project your graph with some dummy node property with a default value? If all nodes use the default value for a property, virtually no extra memory will be used for that node property. So it should not impact performance and so on (except slightly when doing Hope this was helpful, |
Thanks @adamnsch, unfortunately, that workaround might not work in our wrapper function (a utility function that enables communication to Neo4j/GDS) for two reasons. 1- We dont know in advance whether or not the user of the wrapper function will or will not specify any node property to be returned (the graph might be constructed by directly using a GDS functionalities, and not through the wrapper function) 2- Modifying the graph seems not possible (adding a node property to an already created gds graph object, without recreating it). |
I was able to run one algorithm on the graph like louvain to mutate the graph by adding a node property and at the end drop that property. It might not be ideal but it works. |
@Hossein-Tohidi I see
That's an interesting workaround. If you find that Louvain takes a while to run, you could use a linear complexity algorithm like degree centrality instead. Anyway, it sounds like you're unblocked for now which is good. We'll let you know when we launch the aforementioned feature that will allow you to skip using the workaround. Thanks, |
Looking for a function that generates a dataframe consisting of nodeId and nodeLabel
When the graph does not have any node attributes (just
nodeId
andnodeLabels
are present), I cannot find a way to get the nodeLabels back. ThenodeProperties.stream
returns an empty dataframe. (This is working fine when we do have any node properties).nodes_df = gds.graph.nodeProperties.stream(G, list(node_props), listNodeLabels=True)
Additionally,
G.node_labels()
only produces a list of labels without mapping them to the correspondingnodeIds
. I checked theG._graph_info
dictionary as well, but the map does not seem to be stored there.For edges, we have
gds.graph.relationships.stream
andgds.graph.relationshipProperties.stream
, which support retrieving edges with or without properties. However, I couldn't find similar functionalities for nodes.The text was updated successfully, but these errors were encountered: