In some code I'm currently writing, I'm stuck on the following algorithm to implement. The goal is to find real world users using multiple different accounts.
I've a List of UserData. This list is pretty big (> 10M entries)
A UserData
is defined as: { userId, List<TimeSegments> }
. A TimeSegment is {connectionDate, disconnectionDate}
. We can assume here that the average size of the list of timeSegments is 100.
I want do find groups of users such as:
- for each group of users, all timeSegments are non overlapping (we assume here that a user cannot be connected with multiple accounts at the same time)
- for each user U1 in a group of users, there is a user U2 in the same group such as at least one, U1 disconnected and then U2 connected in the following 15 minutes (or the opposite) (we assume here that at least once, a user will disconnect from an account and with another one immediately after)
Of course, the brute force O(n²) solution (find couples of users and then merge those couples) is not good enough due to the size of data
Any idea of how to start this ?
Thanks !