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.

Design decisions - Nodes, Relationships, Attribute types etc

Hi all,

As a newbie I've been scanning the neo4j manuals and videos, but still can't understand some of the basic semantics of neo4j's graph model.

For instance, why are Nodes able to have multiple Labels, but not a Type; while Relationships have a single type (not multiple) but not a Label. I appreciate that both Nodes and Relationships have Attributes, and that consistency seems useful; but just not sure why the differences in terms of Node having Labels and Relationship having Types.

I also wonder whether Nodes or Relationships could themselves be used as Types or Labels, and whether they could be considered as values for Attributes. Which might seem a bit hypergraphy, but seems to me could help to support more flexibility in modelling.

Maybe there are some fundamental graph-theory reasons for these choices, or maybe they're just implementation decisions. I'd appreciate any pointers or explanations which would help me understand.

Thanks!

Paul

1 REPLY 1

intouch_vivek
Graph Steward

Hi @pwilson,

Nodes are classified with their Labels. A node could reside in multiple Labels based on their usecase and model for an example I have two labels Person and Actor and Director. Now node Vivek who is a Person is a Director of movie XYZ and Paul who is a also Person is an actor of Movie XYZ.. Based on my model Design Vivek will possess two labels Person and Director and Paul will also possess two labels Person and Actor.

All the LPG are relationship driven DB. To have an existence of relationship, nodes are must.
Based on the relationship(connection) between two nodes there must be a certain type of relationship. For an example Vivek and Paul have multiple relationships they are FRIEND, Directional relationship CALLED (Vivek -CALLED->Paul) etc.
Incase there is a possibility of multi-label relationship then we cannot find which is the tightly coupled cluster because while finding the cluster(graph) of FRIEND apart from VIVEK and Paul you will see PREM, MERA and several other nodes which came into the picture as Vivek has CALLED them but they are not Vivek's friend.

similarly their are several other use case.
I hope several other community members will throw more light on this.