Learn R Programming

blockr.core (version 0.1.1)

is_acyclic.board: Graph utils

Description

Block dependencies are represented by DAGs and graph utility functions topo_sort() and is_acyclic() are used to create a topological ordering (implemented as DFS) of blocks and to check for cycles. An adjacency matrix corresponding to a board is available as as.matrix().

Usage

# S3 method for board
is_acyclic(x)

# S3 method for links is_acyclic(x)

topo_sort(x)

is_acyclic(x)

# S3 method for matrix is_acyclic(x)

Value

Topological ordering via topo_sort() returns a character vector with sorted node IDs and the generic function is_acyclic() is expected to return a scalar logical value.

Arguments

x

Object

Examples

Run this code
brd <- new_board(
  c(
     a = new_dataset_block(),
     b = new_dataset_block(),
     c = new_scatter_block(),
     d = new_subset_block()
  ),
  list(from = c("a", "d"), to = c("d", "c"))
)

as.matrix(brd)
topo_sort(brd)
is_acyclic(brd)

Run the code above in your browser using DataLab