Creating Relationships

In this lesson, you will learn how to create relationships between nodes.

To complete this activity, you will need the acted_in.csv file that contains the data to match the Person nodes to the Movie nodes.

The ACTED_IN relationship

The ACTED_IN relationship connects a Person node to a Movie node. This relationship indicates that the person acted in the movie.

The relationship has a property called role that stores the name of the character a person played in the movie.

a graph showing the ACTED_IN relationship

The process for creating relationships is similar to creating nodes:

  1. Upload the data

  2. Create the relationship in the model

  3. Map the fields

  4. Run the import

Upload the data

The acted_in.csv file contains the data to match the Person nodes to the Movie nodes. The file contains the following columns:

  • movieId - The unique identifier of the movie

  • person_tmdbId - the unique identifier of the person

  • role - the role the person played

Download the acted_in.csv file and upload it to Data Importer.

Create the relationships

To create a relationship between nodes, hover over the edge of the start node, click, and drag the relationship to the end node.

An animation showing creating a relationship between a Person and a Movie node

You then give the relationship a type, choose which IDs to use to match the nodes in the relationship, and set up any properties.

To create the ACTED_IN relationship, you need to:

  1. Create a relationship between the Person and Movie nodes

  2. Set the relationship type to ACTED_IN

  3. Select the acted_in.csv file

  4. Set the Node ID mapping for the Person and Movie nodes:



    ID column









  5. Map the role property from the file to the relationship

Data Importer showing the setup of the ACTED_IN relationship as described above

Deleting relationships

You can remove an unwanted relationship by selecting the relationship and pressing the delete key.

Once you have set up the relationship, you can run the import.

View the data

You can check that the ACTED_IN relationships have been created by running the following query to find the actors in the movie "Toy Story":

MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
WHERE m.title = 'Toy Story'
RETURN p,r,m
A graph showing the movie "Toy Story" and the actors who acted in it
Need to download a working solution?

This Data Importer model,, contains a working solution for this exercise.

Download the model and open it using the Open model (with data) button in the …​ menu.

The Open model (with data) button highlighted in the menu.

Note that this will replace your existing model.

Check Your Understanding

Relationship Properties

True or False - Relationships can only have the start and end node IDs as properties.

  • ❏ True

  • ✓ False


Relationships in Neo4j are first-class citizens and can have properties just like nodes.


The statement is False - Relationships can have properties, and you can map them from source files.


In this lesson, you learned how to create relationships between nodes.

In the next challenge, you will use what you have learned to import the DIRECTED relationship between Person and Movie nodes.


Hi, I am an Educational Learning Assistant for Intelligent Network Exploration. You can call me E.L.A.I.N.E.

How can I help you today?