0

I'm using py2neo in Python to run my Cypher queries.
I'm trying to create Person nodes and relationships between then.
My DataFrame is like this:

df
>>> id_user      name                 follows.profiles
     a_123       Mc Marcão <3    [a_134, a_934, a_145, a_988]
     a_234       john                       a_111
     a_934       alice                       NaN
       :           :                          :
       :           :                          :

So here we can see that a Person can follows multiple persons, because follows.profiles is a list.

So this is what I did:

for index, row in df.iterrows():
    graph.run('''
    UNWIND $label3 as follow_profile
    MERGE (p1:Profile { id_user: $label1, name: $label2 })
    MERGE (p1)-[:FOLLOWS]->(p2:Profile { id_user: follow_profile })
    ''', parameters = {'label1': row['id_user'],
                       'label2': row['name'],
                       'label3': row['follows.profiles']
                      })

So the nodes are created and their relationships too. Now I want to set labels to the nodes relateds. How can I do this?

enter image description here

Community
  • 1
  • 1
igorkf
  • 3,159
  • 2
  • 22
  • 31

1 Answers1

0

All the nodes you created already have a Profile label. But the neo4j Browser does not show the labels since normally you want identifying information to display for each node. However, the Browser does allow you to specify a different color for each label.

See the documentation for how to do that.

cybersam
  • 63,203
  • 6
  • 53
  • 76