Hey guys, so I'm following this guide/excercise on neo4j about a movie database, where I'm also using the same data from there(link here).
Now my problem is trying to find the co-co actors of a particular person. eg Tom Hanks.
co co actors are all the actors who have acted in a movie with a co-actor of Tom Hanks, but have not acted in a movie with Hanks
Now looking at the solutions for exercise 5.4 from the link, my code should look something like this right?
I run the code, but there's no output/records
MATCH (a:Actor)-[:ACTED_IN*2]->(a2:Actor)
WHERE a.name = "Tom Hanks"
AND NOT((a)-[:ACTED_IN]-(a2))
RETURN a2.name AS `co-co-actors``
If, it's okay, can I expand on the question from the answer given on there?
So if a few co-co actors of Tom Hanks appear in multiple movies with Tom hanks co-actors, so for instance Jack nicholas is a co-co actor of Tom Hanks who has acted in more than one movie with Tom hanks co actors. Then we can say that they have multiple paths between Tom and Jack. How would I sort a list according to the number of paths between the two of them? Hopefully my explanation makes sense.
So with what I was explaining, I tried to write the code for it but I'm not sure if what I wrote does what It's suppose to do.
MATCH (tom:Person)-[r1:ACTED_IN]->(m:Movie)<-[r2:ACTED_IN]-(a2:Person)- [r3:ACTED_IN]->(m2:Movie)<-[: ACTED_IN]-(a3:Person)
WHERE tom.name = 'Tom Hanks'
RETURN a3.name,count(m2) as NO_Paths order by NO_Paths desc