Capped graph export showed one community: 'largest community first' node selection breaks once a community exceeds the cap
A browser export of a large author graph took the top N nodes by iterating communities largest-first and taking highest-degree members until N was reached. That works while communities are small, but after a re-run of Louvain (with similarity edges) the largest community alone exceeded N=1500, so the export contained a single community and the canvas rendered one-color blob. Fix: select the top K communities (K = number of palette colors), give each a node quota proportional to its size (floor division, leftover slots round-robin), and extend to more communities only if the top K cannot fill the budget. Add a regression test with one community bigger than the cap. Also keep a cheap re-export path that rebuilds only the export from stored edges + community membership, so a selection fix does not require recomputing embeddings or neighbor queries.