Skip to contents

A complete, renderer-agnostic network: a list of GraphNode objects, a list of GraphEdge objects, and a directedness flag. The R analog of the GraphModel TypeScript interface in rtemislive (~/Code/live/src/lib/types.ts), consumed by the rtemis-graph htmlwidget.

Usage

GraphModel(nodes = list(), edges = list(), directed = logical(0))

Arguments

nodes

List: List of GraphNode objects.

edges

List: List of GraphEdge objects.

directed

Logical: Whether edges are directed.

Value

GraphModel object.

Details

Most users build this implicitly through draw_network(); the constructor is exported for power users who assemble nodes and edges directly.

Examples

GraphModel(
  nodes = list(GraphNode(id = "a"), GraphNode(id = "b")),
  edges = list(GraphEdge(source = "a", target = "b")),
  directed = FALSE
)
#> <rtemis.draw::GraphModel>
#>  @ nodes   :List of 2
#>  .. $ : <rtemis.draw::GraphNode>
#>  ..  ..@ id   : chr "a"
#>  ..  ..@ label: NULL
#>  ..  ..@ value: NULL
#>  ..  ..@ group: NULL
#>  .. $ : <rtemis.draw::GraphNode>
#>  ..  ..@ id   : chr "b"
#>  ..  ..@ label: NULL
#>  ..  ..@ value: NULL
#>  ..  ..@ group: NULL
#>  @ edges   :List of 1
#>  .. $ : <rtemis.draw::GraphEdge>
#>  ..  ..@ source: chr "a"
#>  ..  ..@ target: chr "b"
#>  ..  ..@ weight: NULL
#>  ..  ..@ sign  : NULL
#>  @ directed: logi FALSE