Generate the ggraph layout of a time unfolded graph

get_unfolded_layout(
  edge.list,
  select_cols = NULL,
  nodes = NULL,
  vertical = FALSE,
  resize_ratio = NULL,
  enlarge_ratio = 1,
  ...
)

Arguments

edge.list

data.frame or tibble containing the edge list. It needs at least three column: the column with edge sources, the edge targets, and the timestamps of each edge. The order of columns should be 'timestamp', 'source', 'target'. If the edge.list columns come in different orders, use `select_cols` to specify the right order. See the example for details.

select_cols

optional vector of 3 (2 for multi-graphs) elements specifying which columns are the source,target, and attributes from which building the graph. Otherwise Column 1 is assumed to be the source, column 2 the target, column 3 the attribute. In the case of multi-graphs, the third element is not needed and the number of edges between each pair of vertices is computed according to 'aggr_expression'.

nodes

optional vector containing all node names in case disconnected nodes should be included.

vertical

unfold vertically or horizontally? Defaults to FALSE (horizontal)

resize_ratio

ratio between horizontal and vertical dimensions of the grid layout. value < 1 gives a longer vertical side, >1 longer horizontal side.

enlarge_ratio

enlarge both y and x axis by this parameter. Defaults is 1.

...

extra parameters passed to internal methods

Value

ggraph layout object to plot the time unfolded network

Examples

el <- data.frame( from = c('A','B', 'A','B','B', 'A','C','C', 'A','B','C', 'D'), to = c('C','C', 'C','C','D', 'C','D','E', 'C','C','E', 'E'), ts = c( 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 6) ) get_unfolded_adjacency(el, select_cols = 1:3)
#> 35 x 35 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 35 column names ‘A_0’, ‘A_1’, ‘A_2’ ... ]]
#> #> A_0 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . #> A_1 . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . #> A_2 . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . #> A_3 . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . #> A_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> A_5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> A_6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> B_0 . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . #> B_1 . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . . . #> B_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> B_3 . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . #> B_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> B_5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> B_6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> C_0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> C_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> C_2 . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . #> C_3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . #> C_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> C_5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> C_6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> D_5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 #> D_6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> E_6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .