Adding relationships to models

Neomodel provides the following classes in the neomodel package for defining relationships between nodes or entities:

  • Relationship: This class is used to define a bi-directional relationship in which the "direction" of the relationship does not matter. It can be in any direction. For example, in our social data model we are using the FRIEND relationship in which direction does not matter, because if one person declares being a friend to another then vice-versa is also true.
  • RelationshipTo: It is used to define the outgoing relationship.
  • RelationshipFrom: It is used to define the incoming relationship.

All of these classes accept four parameters and expose the connect() method to establish a relationship with the given ...

Get Building Web Applications with Python and Neo4j now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.