Skip to contents

This function prepares the edge data for visualization by calculating the coordinates for line segments representing edges based on the node layouts provided by get_node_layout. It is specifically tailored for use with netify objects and their corresponding layout data.

Usage

get_edge_layout(netlet, nodes_layout)

Arguments

netlet

A netify object used to derive the graph and edges.

nodes_layout

A matrix or a list of matrices representing node layouts for visualization. Each matrix should include the following columns: - actor: A character string identifying each node. - x: Numeric, the x-coordinate of the node in the layout. - y: Numeric, the y-coordinate of the node in the layout. In longitudinal studies, nodes should be a list where each element is a matrix corresponding to a specific time point, named with the respective year or time label (e.g., '2008', '2009'). Each matrix must maintain consistent structure and naming conventions for time points.

         Example structure for `nodes`:
         ```
         $`2008`
         actor          x             y
         Afghanistan  0.5852844  0.4633507
         Albania      0.0976207  0.8473642
         ...

         $`2009`
         actor          x             y
         Afghanistan -0.7392849  0.5709252
         Albania     -1.1160445  1.0141463
         ...
         ```
         Each matrix uses the `actor` names for row identification.

Value

A matrix with edge layout information or list of the same with their start and end coordinates ('x1', 'y1' for the 'from' node and 'x2', 'y2' for the 'to' node).

Author

Cassy Dorff, Shahryar Minhas