You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a sepnodes_on_path parameter to tskeleton (default FALSE) that, when set to TRUE, only rejects an edge x–y if all elements of the separating set lie on some indirect simple path between x and y in the current skeleton.
Motivation
Issue #161 added a diagnostic log that records whether each separating set is structurally plausible. The natural next step is to make this actionable: if sepnodes_on_path = TRUE, a candidate separating set that contains a node not on any indirect path between x and y is considered structurally implausible and the edge is not removed on its basis.
As a side effect, when sepnodes_on_path = TRUE all rows in the diagnostic log will have sepset_on_path = TRUE by construction — the log remains useful for recording pval and n_complete.
Proposed Behaviour
sepnodes_on_path
Behaviour
FALSE (default)
Standard PC skeleton: edge removed whenever pval >= alpha. No change to existing behaviour.
TRUE
Edge x–y is only removed if pval >= alphaandis_sepset_on_path(x, y, nbrs[S], G) returns TRUE.
Implementation
The change in tskeleton.R is localised to the pval >= alpha block:
if (pval>=alpha) {
if (verbose) { ...logrow... } # always log when pval >= alphaif (!sepnodes_on_path|| is_sepset_on_path(x, y, nbrs[S], G)) {
G[x, y] <-G[y, x] <-FALSEsepset[[x]][[y]] <-nbrs[S]
break
}
}
The diagnostic log is written whenever pval >= alpha, independent of sepnodes_on_path, so it always reflects the raw CI test results.
Acceptance Criteria
sepnodes_on_path = FALSE is the default — existing behaviour fully preserved
When TRUE, edge removal additionally requires is_sepset_on_path to return TRUE
Diagnostic log still records all pval >= alpha events regardless of the flag
Flag threaded from tpc() → tskeleton()
Flag exposed as a wildcard in script.R and rule.smk
schema.json updated with sepnodes_on_path boolean field
Summary
Add a
sepnodes_on_pathparameter totskeleton(defaultFALSE) that, when set toTRUE, only rejects an edgex–yif all elements of the separating set lie on some indirect simple path betweenxandyin the current skeleton.Motivation
Issue #161 added a diagnostic log that records whether each separating set is structurally plausible. The natural next step is to make this actionable: if
sepnodes_on_path = TRUE, a candidate separating set that contains a node not on any indirect path betweenxandyis considered structurally implausible and the edge is not removed on its basis.As a side effect, when
sepnodes_on_path = TRUEall rows in the diagnostic log will havesepset_on_path = TRUEby construction — the log remains useful for recordingpvalandn_complete.Proposed Behaviour
sepnodes_on_pathFALSE(default)pval >= alpha. No change to existing behaviour.TRUEx–yis only removed ifpval >= alphaandis_sepset_on_path(x, y, nbrs[S], G)returnsTRUE.Implementation
The change in
tskeleton.Ris localised to thepval >= alphablock:The diagnostic log is written whenever
pval >= alpha, independent ofsepnodes_on_path, so it always reflects the raw CI test results.Acceptance Criteria
sepnodes_on_path = FALSEis the default — existing behaviour fully preservedTRUE, edge removal additionally requiresis_sepset_on_pathto returnTRUEpval >= alphaevents regardless of the flagtpc()→tskeleton()script.Randrule.smkschema.jsonupdated withsepnodes_on_pathboolean fieldRelated
is_sepset_on_path,bfs_reachable, and the diagnostic edge logworkflow/rules/structure_learning_algorithms/tpc/R/tskeleton.R—pval >= alphablock (~line 565)workflow/rules/structure_learning_algorithms/tpc/R/tpc.R—tskeleton(...)call (~line 371)workflow/rules/structure_learning_algorithms/tpc/script.Rworkflow/rules/structure_learning_algorithms/tpc/rule.smkworkflow/rules/structure_learning_algorithms/tpc/schema.json