Skip to content

[tpc] Add sepnodes_on_path flag to tskeleton to enforce path-constrained edge rejection #162

Description

@felixleopoldo

Summary

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 >= alpha and is_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) { ...log row... }  # always log when pval >= alpha
    if (!sepnodes_on_path || is_sepset_on_path(x, y, nbrs[S], G)) {
        G[x, y] <- G[y, x] <- FALSE
        sepset[[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

Related

  • [tpc] Save edge-rejection diagnostics to file in tskeleton (sepset path sanity check + test stats) #161 — introduced is_sepset_on_path, bfs_reachable, and the diagnostic edge log
  • workflow/rules/structure_learning_algorithms/tpc/R/tskeleton.Rpval >= alpha block (~line 565)
  • workflow/rules/structure_learning_algorithms/tpc/R/tpc.Rtskeleton(...) call (~line 371)
  • workflow/rules/structure_learning_algorithms/tpc/script.R
  • workflow/rules/structure_learning_algorithms/tpc/rule.smk
  • workflow/rules/structure_learning_algorithms/tpc/schema.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions