Titan vertex centric indices vs Neo4j labels

前端 未结 3 1612
北荒
北荒 2021-02-02 02:07

I was trying to make a comparison between these two technologies when approaching this and I was wondering if any of you already have some experience dealing with any or both of

3条回答
  •  天涯浪人
    2021-02-02 02:49

    Agreeing with everything Marko said, one could take it further and argue that in the graph database world local indexes can (and even should) substitute global ones. In my opinion, the single greatest advantage of a graph data model is that it lets you encode your data model into the graph topology, gaining qualitative advantages in terms of flexibility, ease of evolution and performance. With this in mind, I'd argue that labels in Neo4j actually detract from all this; reifying a label into a node with adjacent edges pointing to the source having that label is much more in line with the "schema is the graph" philosophy.

    Of course, if your engine lacks local indexes we are back at the supernode problem. But if you do have them (something which I'd say should be a requirement for something to be called a graph database), you can easily transform your label into a node L, and create relationships pointing to that node for those vertices which you want labeled with L

    v -[L]-> L

    meaning that v has label L. Now if you want this in Titan to behave like a Neo4j label, just make the -[L]-> relation to be "manyToOne" (see Titan cardinality constraints) and create a vertex-centric index. This pattern lets you get everything that you could with labels and much more; you can

    • effectively use this as a namespace for properties relating to that label
    • sort your elements inside one label
    • nest labels easily without losing performance (just use a composite key)
    • separate the declaration of a label L with how elements labeled with it are accessed

提交回复
热议问题