code: public static List<SubGraph> getSubgraphsMatching(SameDiff sd, SubGraphPredicate p) {
          List<SubGraph> out = new ArrayList<>();
          for (DifferentialFunction df : sd.functions()) {
              if (p.matches(sd, df)) {
                  SubGraph sg = p.getSubGraph(sd, df);
                  out.add(sg);
              }
          }
  
          return out;
      }
docs: Get a list of all the subgraphs that match the specified predicate
  
  @param sd SameDiff instance to get the subgraphs for
  @param p  Subgraph predicate. This defines the subgraphs that should be selected in the SameDiff instance
  @return Subgraphs