Compare time according to same relationship and same attribute

Hi,
I am using neo4j to record the use time of each phase of a machine.
The machine will have a fixed route and work to manufacture products in batches.

E.g..
Require : 25 product 1
Recipe: LOC1 -> LOC2 -> LOC3

The machine will repeat manufacturing until the required number of products

But these processes may have some bottlenecks.
Like the machine is doing the same job in the same place, but working time are different.
So I want to compare the time of the same job in the same place and the time difference of all nodes
has connected to find what cause the bottleneck.

Here's the data sample.

Node

LOT_ID FROMTIME TOTIME FROMLOC
1 2020/03/22 00:00:00 2020/03/22 00:00:10 LOC1
1 2020/03/22 00:00:10 2020/03/22 00:00:15 LOC2
1 2020/03/22 00:00:15 2020/03/22 00:00:25 LOC3
2 2020/03/22 00:00:25 2020/03/22 00:00:35 LOC1
2 2020/03/22 00:00:35 2020/03/22 00:00:55 LOC2
2 2020/03/22 00:00:55 2020/03/22 00:01:00 LOC3
EVENTNAME EVENTTIME
clean 2020/03/22 00:00:15
clean 2020/03/22 00:00:50

Relation: next

RelationID FROM_LOC TO_LOC LOT_ID
1 LOC1 LOC2 LOT_1
2 LOC2 LOC3 LOT_1
3 LOC1 LOC2 LOT_2
4 LOC2 LOC3 LOT_2
RelationID EVENTTIME FROMLOC LOT_ID
5 2020/03/22 00:00:15 LOC2 LOT_1
6 2020/03/22 00:00:50 LOC2 LOT_2

1

I want to compare the node that FROMLOC = LOC2.

The normal node is LOT_ID = 1.
The bottleneck node is LOT_ID = 2.

LOT_ID FROMTIME TOTIME FROMLOC
1 2020/03/22 00:00:10 2020/03/22 00:00:15 LOC2
2 2020/03/22 00:00:35 2020/03/22 00:00:55 LOC2

Compute all nodes connected to node FROMLOC = LOC2 with the time difference between them and FROMLOC = LOC2.

Normal group

LOT_ID FROMTIME TOTIME FROMLOC DIFF_TIME
1 2020/03/22 00:00:00 2020/03/22 00:00:10 LOC1 10
1 2020/03/22 00:00:15 2020/03/22 00:00:25 LOC3 -5
LOT_ID EVENTNAME EVENTTIME DIFF_TIME
1 clean 2020/03/22 00:00:15 -5

Bottleneck group

LOT_ID FROMTIME TOTIME FROMLOC DIFF_TIME
2 2020/03/22 00:00:25 2020/03/22 00:00:35 LOC1 10
2 2020/03/22 00:00:55 2020/03/22 00:01:00 LOC3 -5
LOT_ID EVENTNAME EVENTTIME DIFF_TIME
2 clean 2020/03/22 00:00:50 -15

And compare the time difference between the two groups according to the same place.

LOT_ID FROMTIME TOTIME FROMLOC DIFF_TIME
1 2020/03/22 00:00:00 2020/03/22 00:00:10 LOC1 10
2 2020/03/22 00:00:25 2020/03/22 00:00:35 LOC1 10
LOT_ID FROMTIME TOTIME FROMLOC DIFF_TIME
1 2020/03/22 00:00:15 2020/03/22 00:00:25 LOC3 -5
2 2020/03/22 00:00:55 2020/03/22 00:01:00 LOC3 -5
LOT_ID EVENTNAME EVENTTIME DIFF_TIME
1 clean 2020/03/22 00:00:15 -5
2 clean 2020/03/22 00:00:50 -15

So we can find the bottleneck is the clean time.

Is there have any cypher that can help me.

  1. find all connect node.
  2. compute the time difference between connect node and target node.
  3. compare the time difference by same relation, FROMLOC and TOLOC.

Thanks for watching, if you have any ideas, please tell me.
Best Regards.