More than one relationship between the same nodes

Hi guys!

I'm building a example of a solution to count visits between Persons and Places. In this time I have some doubts to modeling.

First of all, what is the better pratice, make various Visit nodes with it's own properties, or put some properties on relationships.

This question is about create nodes with just one relation, like Person-make->Visit and Visit-there->Place (only one node visit with unique relation between them, or, shoud I make various relations Visit, with it's own properties but between the same nodes when it repeats?

I hope that you can understand my english. =/

Thanks for help!


This is how I model:

Create one root node for Places and another node for Visitors.

Add all the Places as child nodes to Places node. Simlarly add all visitors as child nodes to Visitors node.

If a Visitor 'A' visits a Place 'Z', then create a 'VISITS' relation between Visitor 'A' node and Place 'Z' node.

Hope this works for you.


Thanks @ameyasoft!

I have a doubt. The Visitor can visits more than one time the Place, so... I must create n relations between Visitor and Place when it's repeats?

I'm having some trouble to decide, cuz I need to put some property on Visiti relations, like the timestamp, precision, arrival and departure.

The root nodes are not needed anymore since Neo4j 2.0 as you have labels to group nodes into sets.

I would start with relationships and only if you see the need arise to add more information to the visit choose to elevate them to nodes (either in general or in a case-by-case basis).

What is your use-case you want to solve with the data?

It's better to add timestamp, precision, arrival and departure as properties to the Relationship. See the picture below.

I added relationship {date:'01/01/2018'} to "VISITS" relationship. Here visitor 'V1' visits places 'P1' and 'P2' on the same day and also visits 'P1' on a different date. 'V1' has two relations with 'P1'.

You can extend this simple model to suit your needs.


Correction: I added property {date:'01/01/2018'} to the 'VISITS' relationship.

Thak's guys. I think this problem is solved. I will do like ameyasoft way, if I have to make some adjusts that's ok.