Learn R Programming

epistasis (version 0.0.2)

statesGraph: Make a graph that describes possible transitions in a state space model.

Description

Make a graph that describes possible transitions in a ${0,1}^n$ state space model.

Usage

statesGraph(n, up=FALSE)

Arguments

n
Integer between 1 and 8.
up
Logical scalar, see Details.

Value

Details

Creates a graph whose nodes are all $2^n$ tuples in ${0,1}^n$, e.g. for n=3: 000, 001, 010, 011, 100, 101, 110, 111, and whose directed edges connect two nodes if the end node can be obtained from the start node by turning one 0 into a 1 (if up=TRUE) or one 1 into a 0 (if up=FALSE).

Examples

Run this code
g = statesGraph(5, up=FALSE)
  if(interactive()&&require("Rgraphviz"))
    plot(g, nodeAttrs=makeNodeAttrs(g, label=nodeData(g, attr="binary")))

Run the code above in your browser using DataLab