0

I have an neo4j graph. I wish to do community detection and other graph analysis such as betweeness and closeness through python programming.

I used py2neo to connect and query Neo4j. I dont know how to convert py2neo results so that python-igraph can take in and do analysis. My main aim is to do clustering of whole Neo4j graph

Hamsavardhini
  • 101
  • 2
  • 7

1 Answers1

0

So you want to export data from Neo4j into python-graph using py2neo?

You can pass the result object returned from py2neo's Graph.Cypher.execute() method directly to python-igraph's Graph.TupleList constructor method to create an igraph Graph.

For example:

query = '''
MATCH (u:User)-[:BOUGHT]->(p:Product)
RETURN u.name AS user, p.name AS product
'''


results = graph.cypher.execute(query)
igraph = iGraph.TupleList(results)

See this answer for a more complete example.

Community
  • 1
  • 1
William Lyon
  • 8,371
  • 1
  • 17
  • 22