Neo4j time dependent graph model
I need help with the model of my neo4j graph structure for a time dependent domain. See the following sketch for the requirement and problem:
Picture 1 & 2: For each day I have nodes and relationships between them. I define the relationship as co-occurrence between two nodes (eg words) in some lexical unit (sentences). The same node can occur on several days with new nodes or already existing once. See the following example, where we only consider named entities for nodes:
This will result in the graph structure below.
- 2013/01/01:
(Peter) <--2--> (Cassandra)
- 2013/01/08
(Peter) <--1--> (Judith)
(Peter) <--1--> (Cassandra)
Picture 3: The graph structure should support to select a certain time span and get a path from a starting point (P1) to an end point (P2). Here the path is given by the max flow between those two nodes with respect to the accumulated nodes and relations for the specific time span.
Picture 4: It should also be possible to expand nodes according to eg the highest remaining edge weight. Picture 4 shows the expanded graph with 3 additional nodes.
I already know this work 2 and the multi-level index 3 example. The first model do not support good path finding between nodes from different frames. Only the latter one will be helpful for querying time ranges. Hope somebody can help.
Regards.
There are numerous ways to model time in a graph. One way is adding a timestamp, or even start/end time of the period in which the relation was valid. That way, you can query the graph to return subgraphs, or paths, which were valid at a given time.
Ian Robinson (one of the authors of the Graph Databases book) has written a very good blog post about this topic: http://iansrobinson.com/2014/05/13/time-based-versioned-graphs/
Regarding performance, it is true that accessing relationships is a bit more expensive than querying only by relationship type, but you probably will need to benchmark for yourself, with your own data set, so I would suggest to start with the simplest model which works for you, and then optimize performance iteratively, if necessary.
链接地址: http://www.djcxy.com/p/79688.html上一篇: 为什么显式初始化列表更可能失败?
下一篇: Neo4j时间依赖图模型