Skip to contents

This function converts a netify object into an igraph object to compute layout positions using various igraph layout algorithms. It supports both cross-sectional and longitudinal data, with an option for static positioning of actors.

Usage

get_node_layout(
  netlet,
  layout = NULL,
  static_actor_positions = FALSE,
  which_static = NULL,
  seed = 6886
)

Arguments

netlet

A netify object to be used for layout computation.

layout

A character string specifying the layout algorithm from igraph to be used. If NULL and the object mode is 'bipartite', 'bipartite' layout is used; otherwise, 'nicely' is used as default.

static_actor_positions

Logical indicating whether to use static positions for actors. Useful in longitudinal studies where node positions should remain consistent over time. If TRUE, the layout by default is calculated based on a collapsed adjacency matrix across all time points. Users can also specify a specific time point to use as the static layout by setting which_static to the desired time point.

which_static

Integer indicating which time point's layout should be used as the static layout.

seed

Integer specifying the seed for random number generation.

Value

A list containing two elements: nodes and edges. Each of these is a list of data frames representing the nodes and edges for each time point in the netify object. Each node data frame contains columns for node indices, actor names, and their x, y coordinates. Each edge data frame includes from and to node names, along with start and end coordinates for drawing edges.

Author

Cassy Dorff, Shahryar Minhas