cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Applied Graph Algorithms - Cypher Refresher mistake?

In the Cypher Refresher module for the Applied Graph Algorithm Training one of the first tutorial pages has the following:

We’ll start by seeing which cities have the most reviews:

MATCH (c:City) 
RETURN c.name, size((c)<-[:IN_CITY]-()) AS numberOfReviews 
ORDER BY numberOfReviews DESC 
LIMIT 10;

The Yelp Public dataset contains data from a sampling of cities, but we’ll contain our analysis to businesses in the Phoenix area.

Based on the schema, this looks to actually be returning the number of businesses in the returned cities, not the number of reviews. I believe the following would be a more appropriate Cypher query for counting the number of reviews by city:

MATCH (c:City)
RETURN c.name, size((c)<-[:IN_CITY]-(:Business)<-[:REVIEWS]-(:Review)) AS numberOfReviews
ORDER BY numberOfReviews DESC
LIMIT 10;
1 REPLY 1

Hello Steve,

You are absolutely correct. Thank you for pointing this out.

We will correct the browser guide.

Elaine

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online