0

http://neo4j.com/developer/guide-data-modeling/#_labels

"A label is a named graph construct that is used to group nodes into sets."

This is an index that points to a set of Nodes. How does this work? How would you implement this in general for a graph database? Thank you.

nichoth
  • 55
  • 5

3 Answers3

0

Since you know how to use it, you should notice that it is fast to fetch all nodes given a specific label. For instance search for all nodes with label 'Person'. There should be a file (or files) that stores all node ids for each label. So when you want to search all nodes with a specific label, such file will be accessed and all ids of nodes with such label will be returned.

Yuhan Sun
  • 102
  • 5
0

Think of labels as special properties of nodes, that allow a faster lookup than ordinary properties of nodes. They allow you to faster filter or groupby those nodes. Single node can have many labels.

General guidelines for labels:

  1. We use labels to group entities together -- (:Person),(:Company)

Create constraints/indexes on your entities labels for faster querying

  1. We use additional labels as a preprocessed way of filtering nodes faster -- (:Person:Expert),(:Company:VIP)
  2. We can use labels for marking steps in our process -- (:Order:ExportedToElastic),(:Order:Error)
Tomaž Bratanič
  • 6,319
  • 2
  • 18
  • 31
-2

Labels in Neo4j correspond toe tables from Relational DB like labels in gmail correspond to folders in hotmail. You can query them and index them like tabels. The only thing they miss is a predefined set of attributes.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dirk Horsten
  • 3,753
  • 4
  • 20
  • 37
  • 1
    Thank you. I understand how to use them, but I was interested in how they work on a lower level, like what kind of data structure they are build off of. – nichoth Jan 19 '15 at 21:50
  • Fine, I'm looking forward to a more technical answer from someone else. – Dirk Horsten Jan 19 '15 at 22:01