diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java index 535db213b5..2798ecaeb6 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/graph/GraphUtils.java @@ -2920,7 +2920,7 @@ public static Graph repairFaultyPag(Graph pag, FciOrient fciOrient, Knowledge kn pag = new EdgeListGraph(pag); fciOrient.setKnowledge(knowledge); -// anyChange = resolveAlmostCycles1(pag, knowledge, unshieldedColliders, verbose, anyChange); +// boolean anyChange = resolveAlmostCycles1(pag, knowledge, unshieldedColliders, verbose); boolean anyChange = removeAlmostCycles2(unshieldedColliders, fciOrient, pag, knowledge, verbose); if (checkCyclicity) { @@ -2959,8 +2959,9 @@ public static Graph repairFaultyPag(Graph pag, FciOrient fciOrient, Knowledge kn return pag; } - private static boolean resolveAlmostCycles1(Graph pag, Knowledge knowledge, Set unshieldedColliders, boolean verbose, boolean anyChange) { + private static boolean resolveAlmostCycles1(Graph pag, Knowledge knowledge, Set unshieldedColliders, boolean verbose) { boolean changed; + boolean anyChange = false; do { changed = false; @@ -2981,19 +2982,20 @@ private static boolean resolveAlmostCycles1(Graph pag, Knowledge knowledge, Set< pag.removeEdge(x, y); pag.addDirectedEdge(x, y); - List into = pag.getNodesInTo(x, Endpoint.ARROW); - - for (Node _into : into) { -// pag.setEndpoint(_into, x, Endpoint.CIRCLE); - if (pag.isAdjacentTo(_into, x) && !pag.isAdjacentTo(_into, y)) { - pag.setEndpoint(_into, x, Endpoint.CIRCLE); - pag.addNondirectedEdge(_into, y); - } - - if (unshieldedColliders != null) { - unshieldedColliders.remove(new Triple(_into, x, y)); - } - } +// List into = pag.getNodesInTo(x, Endpoint.ARROW); +// +// for (Node _into : into) { +//// pag.setEndpoint(_into, x, Endpoint.CIRCLE); +// +// if (pag.isAdjacentTo(_into, x) && !pag.isAdjacentTo(_into, y)) { +// pag.setEndpoint(_into, x, Endpoint.CIRCLE); +// pag.addNondirectedEdge(_into, y); +// } +// +// if (unshieldedColliders != null) { +// unshieldedColliders.remove(new Triple(_into, x, y)); +// } +// } if (verbose) { TetradLogger.getInstance().log("FAULTY PAG CORRECTION: Because " + x + " ~~> " + y + ", oriented " + y + " <-> " + x + " as " + x + " -> " + y + "."); @@ -3030,6 +3032,7 @@ private static boolean resolveAlmostCycles1(Graph pag, Knowledge knowledge, Set< } } } while (changed); + return anyChange; } diff --git a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java index 8a26b2469a..2e1182f56b 100644 --- a/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java +++ b/tetrad-lib/src/main/java/edu/cmu/tetrad/search/GFci.java @@ -374,4 +374,22 @@ public void setAblationLeaveOutFinalOrientation(boolean ablationLeaveOutFinalOri public void setSepsetFinderMethod(int sepsetFinderMethod) { this.sepsetFinderMethod = sepsetFinderMethod; } + + /** + * Sets whether the discriminating path tail rule should be used. + * + * @param doDiscriminatingPathTailRule True, if so. + */ + public void setDoDiscriminatingPathTailRule(boolean doDiscriminatingPathTailRule) { + this.doDiscriminatingPathTailRule = doDiscriminatingPathTailRule; + } + + /** + * Sets whether the discriminating path collider rule should be used. + * + * @param doDiscriminatingPathColliderRule True, if so. + */ + public void setDoDiscriminatingPathColliderRule(boolean doDiscriminatingPathColliderRule) { + this.doDiscriminatingPathColliderRule = doDiscriminatingPathColliderRule; + } }