Fraud rings count accounts
transcript
A wallet app hunts for fraud rings. Accounts log in from shared devices. A shared device links the accounts together.
Each new login can join two groups into one. A group never has to be split again. That is the case union-find was made for.
There are six logins, and so six answers. The first ring grows to two accounts. The fifth login joins two rings into four.
Each group stores the root that names it. It also stores how many accounts it holds. A device adds nothing to that count.
Count accounts only, and the ring has four. Count the devices too, and it seems to have six.
Find the roots of the account and the device. Join the smaller group under the larger one. Then add up the account counts.
Fraud rings often share a few devices. The rings grow as new logins arrive. The fraud desk watches the largest ring.
Union-find keeps the groups. Count only the accounts. Full breakdown in the lecture.