remove_edge: Remove an Edge from Knowledge

View source: R/knowledge-verbs.R

remove_edgeR Documentation

Remove an Edge from Knowledge

Description

Drop a single directed edge specified by from and to. Errors if the edge does not exist.

Usage

remove_edge(kn, from, to)

Arguments

kn

A Knowledge object.

from

The source node (unquoted or character).

to

The target node (unquoted or character).

Value

The updated Knowledge object.

See Also

Other knowledge functions: +.Knowledge(), add_exogenous(), add_tier(), add_to_tier(), add_vars(), as_bnlearn_knowledge(), as_pcalg_constraints(), as_tetrad_knowledge(), convert_tiers_to_forbidden(), deparse_knowledge(), forbid_edge(), get_tiers(), knowledge(), knowledge_to_caugi(), remove_tiers(), remove_vars(), reorder_tiers(), reposition_tier(), require_edge(), seq_tiers(), unfreeze()

Examples

# remove variables and their incident edges
data(tpc_example)

kn <- knowledge(
  head(tpc_example),
  tier(
    child ~ starts_with("child"),
    youth ~ starts_with("youth"),
    oldage ~ starts_with("old")
  ),
  child_x1 %-->% youth_x3
)
print(kn)

kn <- remove_edge(kn, child_x1, youth_x3)
print(kn)

kn <- remove_vars(kn, starts_with("child_"))
print(kn)

kn <- remove_tiers(kn, "child")
print(kn)

causalDisco documentation built on April 13, 2026, 5:06 p.m.