1. A computer-implemented method, comprising: calculating, by a processing device, node centralities of a graph until a designated number of central nodes are detected; selecting a percentage of the central nodes as pivot nodes; collapsing neighboring nodes to each pivot node until the graph shrinks to a predefined threshold of total nodes; and outputting the graph responsive to reaching the predefined threshold.