Having a graph of people who like rated movies, I would like to extract for each pair of people their highest rated movie. I'm using the following query which requires sorting movies on their rate for each pair of people.
MATCH (p1:People) -[:LIKES]-> (m:Movie) <-[:LIKES]- (p2:People) WHERE id(p1) < id(p2)
WITH p1, p2, m ORDER BY m.Rating desc
RETURN p1, p2, head(collect(m) as best
I can put movie rating (1/rating or maxRating-rating) into :LIKES relationships, which hence let me identify which movie is in the top rating of both people.
MATCH (p1:People), (p2:People) call apoc.algo.dijkstra(p1, p2, 'LIKES', 'rating') YIELD path as path, weight as weight return path, weight
Is there a way to use a Dijkstra-like algorithm which would find the allOptimumPath through highest scored nodes to improve the performance of my first query and return paths rather than their starting, middle and ending nodes ? Many thanks in advance.