moved subgraph enumeration code into module