Change color of a node in a graph of Neo4J

0

I created an example graph in Neo4J with one parent and two children. I would like to know how to change the color of all nodes that have level equal to 1.

WhenIclickonthenodeitappearsatthebottomtomodifythesizeandcolorbutthechangeaffectsallandnotonlythosethathavethelevelvalueequalto1.SomeimagesthatIfoundonthewebshowthenodeswithdifferentcolorsbutIhavenotfiguredouthowtoapplythis,eitherviatheinterfaceorusingthelibpy2neo(Python)Iamusing.Mycodelookslikethis:

frompy2neoimportGraph,Pathfrompy2neoimportNodefrompy2neoimportRelationshipgraph=Graph('http://neo4j:senha_falsa@localhost:7474/db/data/')graph.delete_all()a=Node("Conta", email="[email protected]", name="Argos", nivel="0")
b = Node("Conta", email="[email protected]", name="Riana", nivel="1")
c = Node("Conta", email="[email protected]", name="Elias", nivel="1")

graph.create(Relationship(a, "PAI DE", b))
graph.create(Relationship(a, "PAI DE", c))

I wanted to know if without how to pass size and color as attributes.

    
asked by anonymous 26.07.2017 / 19:38

1 answer

1

@rodrigorf, these size and color options for the nodes you refer to are only referred to as the Neoj4 Browser presents the result of your queries Cypher. That is: there is no relationship between these display options and the Python language or the py2neo library. So you will not be able to change them through these.

In addition, the option offered by the Neo4j Browser that allows to change the color of nodes is related to the label of these nodes. This way, you will be able to change the color of your nodes according to the label of each one. For example, you can define that all nodes with label :User are red and all nodes with label :Product are blue.

If you're looking for a preview option that gives you more flexibility in the display options, I suggest you take a look at in this link where some graph visualization libraries compatible with Neo4j are presented.

    
08.08.2017 / 03:27