public static Graph dagFromPattern(Graph pattern) {
   DagInPatternIterator dags = new DagInPatternIterator(pattern);
   return dags.next();
   //        Graph graph = new EdgeListGraph(pattern);
   //        pdagToDag(graph);
   //        return graph;
 }
  public static List<Graph> getDagsInPatternMeek(Graph pattern, Knowledge knowledge) {
    DagInPatternIterator iterator = new DagInPatternIterator(pattern);
    List<Graph> dags = new ArrayList<Graph>();

    while (iterator.hasNext()) {
      Graph graph = iterator.next();

      try {
        //                Dag dag = new Dag(graph);

        if (knowledge.isViolatedBy(graph)) {
          continue;
        }

        dags.add(graph);
      } catch (IllegalArgumentException e) {
        System.out.println("Found a non-DAG: " + graph);
      }
    }

    return dags;
  }