Select vertices on the basis of a primary and secondary attribute

I want to select vertices on the basis of two attributes in a hierarchy. For example if I have a school populated by students with an attribute describing the classrooms, .vs.select(class_eq=N) will choose all the students in a given class N. If I have a second attribute describing grades, I can select those with high grades with .vs.select(grade_gt=90).

Now I want to select all the classmates of those with high grades, and I’m at a loss how to do it. I see the VertexClustering object, which might do the trick if I define it for a specific example. If possible I’d like to select on the basis of hierarchical conditions by expanding from the nodes that satisfy condition A to those of condition B, like a neighborhood restricted by the second attribute. Is there a simple way to do that?

I hope this is clear enough. I’m new to igraph.