Loading problem...
A social network analytics team is auditing direct connection quality.
Table: Friends
A direct pair (u, v) should appear in the output only when they do not have any shared mutual contact. In other words, there must be no third user w such that:
Return all qualifying direct pairs.
Output requirements:
Notes:
Supported submission environments:
Friends:
| user_id1 | user_id2 |
|----------|----------|
| 1 | 2 |
| 2 | 3 |
| 2 | 4 |
| 1 | 5 |
| 6 | 7 |
| 3 | 4 |
| 2 | 5 |
| 8 | 9 |[
{"user_id1":6,"user_id2":7},
{"user_id1":8,"user_id2":9}
]Pairs (6,7) and (8,9) have no shared contacts. The other direct pairs each share at least one mutual friend.
Friends:
| user_id1 | user_id2 |
|----------|----------|
| 10 | 11 |
| 11 | 12 |
| 12 | 13 |[
{"user_id1":10,"user_id2":11},
{"user_id1":11,"user_id2":12},
{"user_id1":12,"user_id2":13}
]In a simple chain, each direct pair has no third common neighbor.
Friends:
| user_id1 | user_id2 |
|----------|----------|
| 21 | 22 |
| 22 | 23 |
| 21 | 23 |[]This triangle has one shared contact for every edge, so all direct pairs are excluded.
Constraints