make.graph: Create graph object.

View source: R/graph-functions.R

make.graphR Documentation

Create graph object.

Description

This function create a graph object that can be used in other functions in this package.

Usage

make.graph(vertices, bi_edges, di_edges, multivariate.variables = NULL)

Arguments

vertices

A character vector of vertices in the graph.

bi_edges

A list of vectors that record the bidirectional edges in the graph. For example, bi_edges=list(c('A','B')) means there is a bidirectional edge between vertex A and B.

di_edges

A list of vectors that record the directed edges in the graph. For example, di_edges=list(c('A','B')) means there is a directed edge from vertex A to B.

multivariate.variables

A list of variables that are multivariate in the causal graph. For example, ⁠multivariate.variables=list(M=c('M1,'M2'))⁠ means M is bivariate and the corresponding columns in the dataframe are M1 and M2. Default is NULL.

Value

A graph object with the following components:

vertices

Equivalent to the input argument vertices.

fixed

A data frame with a column fixed that indicates whether the vertex is fixed or not. The vertices is not fixed initially.

bi_edges

Equivalent to the input argument bi_edges.

di_edges

Equivalent to the input argument di_edges.

multivariate.variables

A list of variables that are multivariate in the causal graph. For example, ⁠multivariate.variables=list(M=c('M1,'M2'))⁠ means M is bivariate and the corresponding columns in the dataframe are M1 and M2. Default is NULL.

Examples

make.graph(vertices=c('A','M','L','Y','X'),
bi_edges=list(c('A','Y')),
di_edges=list(c('X','A'), c('X','M'), c('X','L'),
c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y')))


flexCausal documentation built on March 29, 2026, 5:08 p.m.