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

Cannot product graph using networkx #5

Open
skyrack opened this issue Jan 22, 2018 · 1 comment
Open

Cannot product graph using networkx #5

skyrack opened this issue Jan 22, 2018 · 1 comment

Comments

@skyrack
Copy link

skyrack commented Jan 22, 2018

When executing g = results.get_graph(), I'm getting

TypeError Traceback (most recent call last)
in ()
4 results = get_ipython().run_line_magic('cypher', 'http://neo4j:password@localhost:7474 MATCH p = (:Person)-[:LIKES]->(:Drink) RETURN p')
5
----> 6 g = results.get_graph()
7
8 nx.draw(g)

/usr/local/lib/python3.6/site-packages/cypher/run.py in get_graph(self, directed)
202 properties = copy.deepcopy(node['properties'])
203 properties['labels'] = node['labels']
--> 204 graph.add_node(node['id'], properties)
205 for rel in item['relationships']:
206 properties = copy.deepcopy(rel['properties'])

TypeError: add_node() takes 2 positional arguments but 3 were given

Any resolution please?

@marimeireles
Copy link

Hey @skyrack I know it's not very related, but I made some changes to the original notebook, and got a minimal working example on the networkx. So, there is nothing broken, I think. Here's what I'm running locally:

from py2neo import Graph

graph = Graph()

%load_ext cypher

%%cypher http://neo4j:neo4jbinder@localhost:7474/db/data
create
    (Neo:Crew {name:'Neo'}),
    (Morpheus:Crew {name: 'Morpheus'}),
    (Trinity:Crew {name: 'Trinity'}),
    (Neo)-[:KNOWS]->(Morpheus),
    (Neo)-[:LOVES]->(Trinity)

import networkx as nx
%matplotlib inline

results = %cypher MATCH (n) RETURN n

g = results.get_graph()

nx.draw(g)

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

No branches or pull requests

2 participants