Challenge: Native Projection

Now for a challenge.

Create a native graph projection

Create a native graph projection representing people who acted in movies.

You will need to use the gds.graph.project procedure to create the graph projection.

The syntax for the gds.graph.project procedure is:

cypher
CALL gds.graph.project(
  graphName: String,
  nodeLabels: List of String,
  relationshipTypes: List of String
)

The projection should:

  1. Use the name people-acted-in-movies

  2. Include nodes with the labels Person and Movie

  3. Use the ACTED_IN relationship

Once you have created the projection, you can verify that it was created successfully by listing the graph projections in the database:

cypher
CALL gds.graph.list() YIELD graphName

Click the Check Database button to verify that there is a projection named people-acted-in-movies and that the task is complete.

Hint

You previously used the following Cypher to create a native graph projection between User and Movie nodes with the RATED relationship:

cypher
CALL gds.graph.project(
  'native-proj',
  ['User', 'Movie'],
  ['RATED']
  )

Solution

You can run the following Cypher statement to create the graph projection.

cypher
CALL gds.graph.project(
  // Name of the projection
  'people-acted-in-movies',
  // Labels of nodes to include in the projection
  ['Person', 'Movie'],
  // Relationship types to include in the projection
  'ACTED_IN'
)

Lesson Summary

In this lesson we went over native projections, the easiest graph projection mechanism in GDS.

In the next lesson we will go over Cypher projections, a more flexible mechanism for projecting graphs in GDS.