Neo-4j time-dependent chart model

I need help with a model of my neo4j chart structure for a time-dependent domain. See the following sketch for requirements and problems:

Problem sktech

  • Figure 1 and 2: for each day, I have nodes and relationships between them. I define the relationship as a match between two nodes (for example, words) in some lexical unit (sentences). The same node may appear within a few days with new nodes or existing one. See the following example, where we consider only named objects for nodes:

    • 2013/01/01: Peter was thinking about Cassandra today.
    • 2013/01/01: Cassandra wants to stay home with Peter.
    • ....
    • 2013/01/08: Peter fell in love with Judith.
    • 2013/01/08: Kassandra goes to school every day to school.

    This will lead to the structure of the graph below.

    - 2013/01/01: (Peter) <--2--> (Cassandra) - 2013/01/08 (Peter) <--1--> (Judith) (Peter) <--1--> (Cassandra) 
  • Figure 3: The structure of the graph should support the selection of a certain period of time and get the path from the start point (P1) to the end point (P2). Here, the path is determined by the maximum flow between these two nodes relative to the accumulated nodes and relations for a certain time interval.

  • Figure 4: You must also expand the nodes to match, for example, the highest remaining edge weight. Figure 4 shows an extended graph with three additional nodes.

I already know this work 2 and multi-level index 3 . The first model does not support a good path search between nodes from different frames. Only the latter will be useful for querying time ranges. Hope someone can help.

Sincerely.

+7
graph neo4j cypher
source share
1 answer

There are many ways to simulate time on a chart. One way is to add a timestamp or even the start / end time of the period in which the relationship was valid. Thus, you can request a graph to return the subgraphs or paths that were valid at a given time.

Ian Robinson (one of the authors of the book "Graph Databases") wrote a very good blog post on this topic: http://iansrobinson.com/2014/05/13/time-based-versioned-graphs/

As for performance, it’s true that access to relationships is a bit more expensive than querying only by type of relationship, but you probably need to focus on yourself with your own data set, so I would suggest starting with the simplest model that works for you, and then optimizes performance iteratively, if necessary.

+4
source share

All Articles