matrix_to_dstl: Convert a Matrix into a Demand Structural Tree List

View source: R/matrix_to_dstl.R

matrix_to_dstlR Documentation

Convert a Matrix into a Demand Structural Tree List

Description

Convert a demand coefficient matrix into a demand structural tree list.

Usage

matrix_to_dstl(
  x,
  names.commodity = paste("comm", 1:nrow(x), sep = ""),
  names.agent = paste("agt", 1:ncol(x), sep = "")
)

Arguments

x

a matrix.

names.commodity

names of commodities. They will be the names of leaf nodes of each demand structural tree.

names.agent

names of agents. They will be the names of root nodes of those demand structural trees.

Value

A demand structural tree list.

Examples


A <- matrix(c(
  0, 0, 0, 1,
  8, 6, 1, 0,
  4, 2, 1.5, 0,
  2, 1.5, 0.5, 0
), 4, 4, TRUE)

dstl <- matrix_to_dstl(A)
node_print(dstl[[1]])



GE documentation built on Nov. 8, 2023, 9:07 a.m.

Related to matrix_to_dstl in GE...