{"type":"excalidraw","version":2,"source":"https://AwesomeSystemDesign.dev","elements":[{"angle":0,"strokeColor":"#6577aa","backgroundColor":"#eef1fc","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-1"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-1"}],"updated":0,"link":null,"locked":false,"id":"shape-0","type":"rectangle","seed":41,"x":16,"y":16,"width":288,"height":1065.6000000000001,"customData":{"revealStep":1}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-1"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-1","type":"text","seed":114,"x":36,"y":34,"width":248,"height":1029.6000000000001,"fontSize":22,"fontFamily":1,"text":"READ PATH\n\n• Connection List:\nGET\n/users/{id}/connectio\nns → Read adjacency\nlist from in-memory\nstore (< 5 ms) → If\nnot in memory, fetch\nfrom persistent\nstore + cache\n\n• Mutual Connections:\nGET\n/users/{A}/mutual/{\nB} → Fetch adjacency\nlists for A and B →\nSet intersection:\nA.connections ∩\nB.connections →\nReturn sorted by\nrelevance (closeness\nto viewer)\n\n• Degree of\nSeparation: GET\n/users/{A}/degree/{\nB} → BFS from A\ntoward B\n(bidirectional for\nefficiency) → Max\ndepth: 3 (1st, 2nd,\n3rd degree; beyond =\n\"out of net\") → Cache\nresult (stable for\nhours)","originalText":"READ PATH\n\n• Connection List:\nGET\n/users/{id}/connectio\nns → Read adjacency\nlist from in-memory\nstore (< 5 ms) → If\nnot in memory, fetch\nfrom persistent\nstore + cache\n\n• Mutual Connections:\nGET\n/users/{A}/mutual/{\nB} → Fetch adjacency\nlists for A and B →\nSet intersection:\nA.connections ∩\nB.connections →\nReturn sorted by\nrelevance (closeness\nto viewer)\n\n• Degree of\nSeparation: GET\n/users/{A}/degree/{\nB} → BFS from A\ntoward B\n(bidirectional for\nefficiency) → Max\ndepth: 3 (1st, 2nd,\n3rd degree; beyond =\n\"out of net\") → Cache\nresult (stable for\nhours)","textAlign":"left","verticalAlign":"middle","containerId":"shape-0","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":1}},{"angle":0,"strokeColor":"#6577aa","backgroundColor":"#eef1fc","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-2"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-3"}],"updated":0,"link":null,"locked":false,"id":"shape-2","type":"rectangle","seed":187,"x":16,"y":1125.6000000000001,"width":288,"height":922.6,"customData":{"revealStep":2}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-2"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-3","type":"text","seed":260,"x":36,"y":1143.6000000000001,"width":248,"height":886.6,"fontSize":22,"fontFamily":1,"text":"WRITE PATH\n\n• Connection Request\nFlow\n1. User A sends\nrequest to User B\n2. Store pending\nrequest in DB\n3. Notify User B\n(push/email)\n4. User B accepts:\na. Create edge (A→B)\nand (B→A) atomically\nb. Update adjacency\nlists for both users\nc. Increment\nconnection counts for\nboth\nd. Publish event to\nKafka:\n\"connection_created\"\ne. Invalidate PYMK\ncache for both +\nmutual friends\n5. Kafka consumers:\n→ Update graph\nsearch index\n→ Trigger incremental\nPYMK recomputation\n→ Update news feed\nrankings","originalText":"WRITE PATH\n\n• Connection Request\nFlow\n1. User A sends\nrequest to User B\n2. Store pending\nrequest in DB\n3. Notify User B\n(push/email)\n4. User B accepts:\na. Create edge (A→B)\nand (B→A) atomically\nb. Update adjacency\nlists for both users\nc. Increment\nconnection counts for\nboth\nd. Publish event to\nKafka:\n\"connection_created\"\ne. Invalidate PYMK\ncache for both +\nmutual friends\n5. Kafka consumers:\n→ Update graph\nsearch index\n→ Trigger incremental\nPYMK recomputation\n→ Update news feed\nrankings","textAlign":"left","verticalAlign":"middle","containerId":"shape-2","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":2}},{"angle":0,"strokeColor":"#6577aa","backgroundColor":"#eef1fc","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-3"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-5"}],"updated":0,"link":null,"locked":false,"id":"shape-4","type":"rectangle","seed":333,"x":16,"y":2092.2000000000003,"width":288,"height":1208.6000000000001,"customData":{"revealStep":3}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-3"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-5","type":"text","seed":406,"x":36,"y":2110.2000000000003,"width":248,"height":1172.6000000000001,"fontSize":22,"fontFamily":1,"text":"PYMK ENGINE\n\n• Batch Pipeline (runs\nnightly for all active\nusers):\n1. For each user U,\nget 1st-degree\nconnections C1\n2. For each c in C1,\nget their connections\nC2\n→ C2 - C1 - {U} =\ncandidate pool (2nd\ndegree)\n3. Score each\ncandidate:\nmutual_count × 0.4\n+ shared_company ×\n0.2\n+ shared_school ×\n0.15 + shared_skills\n× 0.1\n+ profile_views × 0.1\n+\ngeographic_proximity\n× 0.05\n4. Store top 50\nsuggestions per user\nin cache\nIncremental Updates\n(real-time): On new\nconnection event (A\nconnects to B): → For\neach of A's\nconnections: B is now\n2nd-degree → boost →\nFor each of B's\nconnections: A is now\n2nd-degree → boost →\nUpdate PYMK cache\nfor affected users","originalText":"PYMK ENGINE\n\n• Batch Pipeline (runs\nnightly for all active\nusers):\n1. For each user U,\nget 1st-degree\nconnections C1\n2. For each c in C1,\nget their connections\nC2\n→ C2 - C1 - {U} =\ncandidate pool (2nd\ndegree)\n3. Score each\ncandidate:\nmutual_count × 0.4\n+ shared_company ×\n0.2\n+ shared_school ×\n0.15 + shared_skills\n× 0.1\n+ profile_views × 0.1\n+\ngeographic_proximity\n× 0.05\n4. Store top 50\nsuggestions per user\nin cache\nIncremental Updates\n(real-time): On new\nconnection event (A\nconnects to B): → For\neach of A's\nconnections: B is now\n2nd-degree → boost →\nFor each of B's\nconnections: A is now\n2nd-degree → boost →\nUpdate PYMK cache\nfor affected users","textAlign":"left","verticalAlign":"middle","containerId":"shape-4","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":3}}],"appState":{"viewBackgroundColor":"#fbfbf8","gridSize":null},"files":{}}