Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add.arc

Add an arc to a DAG.


Description

Function to conveniently add an arc to an existing DAG.

Usage

add.arc(dag, arc, type = 0)

Arguments

dag

The DAG to which an arc should be added.

arc

A vector of length 2, indicating from which node (first element) to which node (second element) the arc is to go. Note: the node numbering follows the numbering of the existing DAG (as shown in dag.draw with option numbering=T), not the numbering of dag.init.

type

0 (=default) for a directed arc, 1 for an undirected association.

Value

A DAG with the arc (and corresponding arc.type) added, and with the path-related variables (paths, pathsN, path.status, searchType, searchRes) removed.

Author(s)

Lutz P Breitling <l.breitling@posteo.de>

See Also

Examples

dag1<-demo.dag1();
dag1b<-add.arc(dag1, arc=c(2,4));

dagR

R Functions for Directed Acyclic Graphs

v1.2.0
GPL-2
Authors
Lutz P Breitling
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.