1. A method comprising: determining, by a processor, a plurality of densest subgraphs of a graph, the graph including a plurality of vertices and a plurality of edges interconnecting the vertices, each edge connecting two of the vertices and having a weight, the vertices and the edges forming a plurality of subgraphs of the graph from which the densest subgraphs are determined as the subgraphs of the graph having densities greater than a threshold; determining, by the processor, a plurality of clusters at a plurality of levels of a hierarchy, based on the densest subgraphs that have been determined, each cluster including a set of the vertices and a set of the edges of the graph, each level corresponding to a different density of the clusters, the hierarchy ordered from a most-dense level of the clusters to a least-dense level of the clusters; and outputting, by the processor, the clusters at the levels of the hierarchy that have been determined.