cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to get different colors for starting and ending nodes of path

I have 121 nodes. All are with same label. When i return a path, all comes with same color.
But what I want is, first node of the path should be green and last node should be red.
Please explain me how.
Thank you.

2 REPLIES 2

You can't specify that the first is always one color and the last is another. But you can specify colors for particular labels in the graph. See this screenshot:

You click on the label (like "Category") in the top bar, and then you can pick the color at the very bottom

The browser will only color nodes by Label. There's nothing saying you can't create a label specifically for that purpose.

// prep a label, making sure it no longer exists on any nodes
MATCH (a:RedColor)
REMOVE a:RedColor

// run your cypher command
MATCH p=(a:Thing)-[*]->(b:Thing) 
WHERE length(p) = 3 

// with the nodes you want to "recolor", and values you want to return
WITH p, b

// add that label to the nodes to be "recolored"
SET b :RedColor

RETURN p limit 10;
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online