Coloring nodes in Neo4j depending on property

This is the question I get asked more often: Can I color nodes in Neo4j Desktop and Bloom according to their properties?

Would you recommend this solution from stackoverflow or only under certain conditions?


stackoverflow

For quick visualisations I use virtual nodes and relationships as described in your screenshot – this is not only great for colouring things differently, but also to collapse data to a more comprehensible presentation.

E.g. in a finance related DB I have accounts and payments as separate nodes like (Account)-[has sent]->(Payment)-[has received]->(Account) but presenting it it is easier to show (Account)-[payment]->(Account).

Another angle is to look at Labels, and if there is a need to colour nodes differently in presentation, it might call for "upgrading" the property in question to a Label?

E.g. in my database all transactions have a Transaction label, but also a "TransactionType" label.

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 https://github.com/neo4j-contrib/neovis.js/. The community property determines the color of the node.

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

For Bloom, stay tuned for the upcoming version :slight_smile:

1 Like

Is this gonna be a Christmas present? Or do we have to be patient until 2020?