Generalized subgraph finding