A node label is a type marker attached to a graph node. It says what role the node plays in the domain, such as Person, Organization, User, or Tweet. Labels differ from properties: a label categorizes the node, while properties hold values such as a name, ID, or creation time. section 2.2 section 2.2.1
(:Person {name:"Thomas"})
In Cypher, parentheses represent a node and a colon introduces its label. This pattern describes a Person node with a name property. section 2.2
Choose labels that match the data as closely as possible. A social-media graph may use User and Tweet rather than one broad Post label, because different platforms and post types can require different properties and relationships. Specific labels keep the model closer to the domain and make queries simpler. section 2.3.2
Modeling a follower network
When every node represents a Twitter user, give each node the User label and store its handle or ID as a property for disambiguation. Because only one node label is present, this is a monopartite network. The FOLLOWS relationship supplies the interaction between those User nodes. section 2.3.1
A node can carry more than one label when each label contributes a distinct classification:
- Use a primary domain label such as Person to identify what the node represents. section 2.2.1
- Add secondary labels such as Student or Employee to group nodes for easier retrieval. section 3.1.4
- Keep multiple labels semantically orthogonal, rather than assigning labels with the same or closely overlapping meaning. section 3.1.4
- Avoid placing more than a couple of labels on one node for modeling and performance reasons. section 3.1.4
Use Cypher's SET clause to add a label to an existing node. Labels can also support derived groupings: after calculating a customer's funnel stage, assign a corresponding secondary label so that subset is easy to match later. Creating nodes without labels is not advisable. section 3.1.4 section 3.4
In a graph schema drawing, each node label is commonly shown as one representative node, with that label's properties attached to it. This makes User and Tweet visible as separate node types and shows self-loops for relationships that connect nodes of the same label. LPG schema notation has no official standard. section 2.3.4
