Learn R Programming

BCDAG (version 1.1.2)

get_neighboringDAGs: Enumerate all neighbors of a DAG

Description

This functions takes any DAG with \(q\) nodes as input and returns all the neighboring DAGs, i.e. all those DAGs that can be reached by the addition, removal or reversal of an edge.

Usage

get_neighboringDAGs(DAG)

Value

The \((q,q,K)\) array containing all neighboring DAGs, with \(K\) being the total number of neighbors

Arguments

DAG

Adjacency matrix of a DAG

Examples

Run this code
# Randomly generate a DAG
q <- 4; w <- 0.2
set.seed(123)
DAG <- rDAG(q,w)
# Get neighbors
neighbors <- get_neighboringDAGs(DAG)
neighbors

Run the code above in your browser using DataLab