Clustering in graphs and hypergraphs with categorical edge labels