cancel
Showing results for
Did you mean:

## Issue with the "Creating Lists" Challenge in the Intermediate Cypher Queries course

Hi, I cannot get the correct answer for the above challenge at https://graphacademy.neo4j.com/courses/cypher-intermediate-queries/3-working-with-cypher-data/03-c2-... so stuck at this point. My investigations reveal that there is no Movie in my sandbox instance with more than 4 ACTED_IN relationships. The summary is as follows: ╒════════════════════════════╕ │"MovieCounts" │ ╞════════════════════════════╡ │"Movies with 4 Actors: 8876" │ ├────────────────────────────┤ │"Movies with 3 Actors: 69" │ ├────────────────────────────┤ │"Movies with 2 Actors: 60" │ ├────────────────────────────┤ │"Movies with 1 Actors: 79" │ └────────────────────────────┘ there are also 41 Movies with zero ACTED_IN relationships. The total of the table + the 41 with no relationships makes 9125 movies. This matches the total I get by running "match (n:Movie)return count(n)". So there is no single movie with more actors than any other. Can anyone please shed some light on what's happening here? cheers, Dave
5 REPLIES 5

Sorry about the format of the table. It looked ok before I posted

Ninja

I used the movie guide available in desktop.  I am assuming it is the same data as in the class. I used this query. It returned a "A Few Good Men" with 12 actors.

``````match(a:Person)-[:ACTED_IN]->(m:Movie)
with m, collect(a.name) as actors
return m.title, actors, size(actors) as cnt
order by cnt desc
limit 1``````
Ninja

I just ran the same query in the intermediate cypher course sandbox.  It returned 'toy story' with a count of 4.

Thanks @glilienfield for taking the time to investigate.  Unfortunately the course Movie appears to be different to the alternative you tried since 'A Few Good Men' did not satisfy the verification step.  I also got the answer 'Toy Story' from the course sandbox version so you seem to have confirmed my issue!

Looks like the course needs a fix!

Ninja

I decided to take the course, as I have not taken this one yet and you got me curious. I got through the question. Here was my query.  The answer was "Hamlet'

``````match(p:Person)-[:ACTED_IN]->(m)
return m.title, size(collect(p.name)) as cnt
order by cnt desc
limit 1``````

I figured out the difference.  In my original query I grouped on the Movie node 'm', which collects the actors for that specific movie. In the query above, I grouped on 'm.title', which collects that actors over all Movie nodes with the same title. As it turns out, there are six movie nodes with the same title of 'Hamlet', so all the actors across all the 'Hamlet' movies get collected. This is why there are 24 actors related to the movie title 'Hamlet'.

Nodes 2022

NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.

Neo4j Resources