5.3. Co-favorited places

5.3.1. Co-Favorited Places - Users Who Like x Also Like y
5.3.2. Co-Tagged Places - Places Related through Tags

Graph

cypher-cofavoritedplaces-graph.svg

5.3.1. Co-Favorited Places - Users Who Like x Also Like y

Find places that people also like who favorite this place:

  • Determine who has favorited place x.
  • What else have they favorited that is not place x.

Query

START place=node:node_auto_index(name = "CoffeeShop1")
MATCH place<-[:favorite]-person-[:favorite]->stuff
RETURN stuff.name, count(*)
ORDER BY count(*) DESC, stuff.name

The list of places that are favorited by people that favorited the start place.

Result

stuff.namecount(*)
3 rows, 4 ms

"MelsPlace"

2

"CoffeShop2"

1

"SaunaX"

1


5.3.2. Co-Tagged Places - Places Related through Tags

Find places that are tagged with the same tags:

  • Determine the tags for place x.
  • What else is tagged the same as x that is not x.

Query

START place=node:node_auto_index(name = "CoffeeShop1")
MATCH place-[:tagged]->tag<-[:tagged]-otherPlace

RETURN otherPlace.name, collect(tag.name)
ORDER By otherPlace.name DESC

The list of possible friends ranked by them liking similar stuff that are not yet friends.

Result

otherPlace.namecollect(tag.name)
3 rows, 3 ms

"MelsPlace"

List(Cool, Cosy)

"CoffeeShop3"

List(Cosy)

"CoffeeShop2"

List(Cool)