We study the evolution of cooperation in communities described in terms of graphs, such that individuals occupy the vertices and engage in single rounds of the Prisoner's Dilemma with those individuals with whom they are connected through the edges of those graphs. We find an overwhelming dominance of cooperation whenever graphs are dynamically generated through the mechanisms of growth and preferential attachment. These mechanisms lead to the appearance of direct links between hubs, which constitute sufficient conditions to sustain cooperation. We show that cooperation dominates from large population sizes down to communities with nearly 100 individuals, even when extrinsic factors set a limit on the number of interactions that each individual may engage in.