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:
CALL gds.graph.project(
graphName: String,
nodeLabels: List of String,
relationshipTypes: List of String
)
The projection should:
-
Use the name
people-acted-in-movies
-
Include nodes with the labels
Person
andMovie
-
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:
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:
CALL gds.graph.project(
'native-proj',
['User', 'Movie'],
['RATED']
)
Solution
You can run the following Cypher statement to create the graph projection.
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.