Graphs and classes of finite groups