Skip to content
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

Non-string ids not supported by Neo4jExecutor #26

Closed
jtpdowns opened this issue Feb 25, 2019 · 2 comments · Fixed by #40
Closed

Non-string ids not supported by Neo4jExecutor #26

jtpdowns opened this issue Feb 25, 2019 · 2 comments · Fixed by #40
Labels
Neo4jExecutor Issues having to do with the Neo4jExecutor question Further information is requested

Comments

@jtpdowns
Copy link
Contributor

Ingesting a NetworkX graph with integer ids results in an error: ValueError: Could not export graph: unsupported operand type(s) for +: 'int' and 'str'. It should be straightforward to handle integers, though A node can be any hashable Python object except None. Maybe just cast with repr.

@j6k4m8
Copy link
Member

j6k4m8 commented Feb 26, 2019

I think I want the user to explicitly perform the rename, since they'll have to know what these node IDs are later in order to index the results back into the starting graph.

For example, this is weird:

>>> E = Executor(graph=G)
>>> results = E.find(motif, cursor=False)
>>> results[0][0] in G
False

Granted, str(results[0][0]) in GTrue, but I'm not sure that'd be obvious if this happens silently. Thoughts?

@j6k4m8 j6k4m8 added question Further information is requested Neo4jExecutor Issues having to do with the Neo4jExecutor labels Feb 26, 2019
@j6k4m8
Copy link
Member

j6k4m8 commented Jun 24, 2019

This is resolved in #40.

To make your int-ID'd graph compatible with dotmotif, one can rename the IDs in a NetworkX graph:

Given a networkx.Graph called G:

import networkx as nx

G = nx.relabel_nodes(G, lambda x: str(x))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Neo4jExecutor Issues having to do with the Neo4jExecutor question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants