Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Created May 12, 2019 15:10
Show Gist options
  • Save vladbatushkov/481b0bdc7a0d65af7bbab4be757fd4f9 to your computer and use it in GitHub Desktop.
Save vladbatushkov/481b0bdc7a0d65af7bbab4be757fd4f9 to your computer and use it in GitHub Desktop.
Most used color.
MATCH (:Flag)-[c1:CONTAINS]->(:Color)
WITH sum(c1.weight) as total
MATCH (:Flag)-[c2:CONTAINS]->(cl:Color)
WITH cl.name as colorName, sum(c2.weight) as colorUsed, total
RETURN colorName, colorUsed * 100 / total as percentage
ORDER BY percentage DESC
LIMIT 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment