O'Reilly logo

Building Web Applications with Python and Neo4j by Sumit Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a social network with py2neo

In the previous section, we saw the important APIs exposed by py2neo along with examples for each of them. In this section, we will further use these APIs and see their practical implementations in real-world scenarios.

Let's recreate the social network data which we created using Cypher in Chapter 2, Querying the Graph with Cypher, using various APIs and methods exposed by py2neo.

First and foremost, we will clean up our database, so perform the following steps to do that:

  1. Open your console or command prompt and execute <$NEO4J_HOME>\bin\neo4jshell.
  2. Execute the following Cypher queries to delete the data from Neo4j database:
    OPTIONAL MATCH (n)-[r]-(n1) delete r,n.n1;
    MATCH n delete n;

Next we need to write some ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required