Template-Based Graph Clustering