Group theory for Feynman diagrams in non-Abelian gauge theories