Coloring nodes in Neo4j depending on property

I needed to do the same for my problem and I ended up with two alternative solutions:

  1. Add labels to nodes based on their properties:
match (n:Person)
with distinct n.gender as gender, collect(distinct n) as persons
call apoc.create.addLabels(persons, [apoc.text.upperCamelCase(gender)]) yield node
return *
  1. Use GitHub - neo4j-contrib/neovis.js: Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.. The community property determines the color of the node.

The first one is easier as you don't need another tool.

1 Like