setse_expanded: SETSe embedding showing full convergence history

Description Usage Arguments Value See Also Examples

View source: R/setse_expanded.R

Description

This is a special case function of SETSe which keeps the history of all node movements during convergence0. It is useful for demonstrations, or parametrising difficult networks.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
setse_expanded(
  g,
  force = "force",
  distance = "distance",
  edge_name = "edge_name",
  k = "k",
  tstep = 0.02,
  mass = 1,
  max_iter = 20000,
  coef_drag = 1,
  tol = 1e-06,
  sparse = FALSE,
  verbose = TRUE,
  two_node_solution = TRUE
)

Arguments

g

An igraph object. The network

force

A character string

distance

A character string. The name of the graph attribute that contains the graph distance

edge_name

A character string. This is the edge attribute that contains the edge_name of the edges.

k

A character string. This is k for the moment don't change it.

tstep

A numeric. The time in seconds that elapses between each iteration

mass

A numeric. The mass in kg of the nodes, this is arbitrary and commonly 1 is used.

max_iter

An integer. The maximum number of iterations before terminating the simulation

coef_drag

A numeric. A multiplier used to tune the damping. Generally no need to twiddle

tol

A numeric. Early termination. If the dynamics of the nodes fall below this value the algorithm will be classed as "converged" and the simulation terminates.

sparse

Logical. Whether or not the function should be run using sparse matrices. must match the actual matrix, this could prob be automated

verbose

Logical value. Whether the function should output messages or run quietly.

two_node_solution

Logical. The Newton-Raphson algo is used to find the correct angle

Value

A dataframe equivalent to the node_embeddings dataframe for the other SETSe methods. However, the dataframe includes a row for each node in each iteration of the simulation, as well as an additional column identifying the iteration number. This dataframe can be very large as it contains nxm rows where n is the number of nodes and m is the number of iterations in the simulation.

See Also

Other setse: setse_auto_hd(), setse_auto(), setse_bicomp(), setse()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
g_prep <- biconnected_network%>%
prepare_edges(.) %>%
prepare_continuous_force(., node_names = "name", force_var = "force", k = NULL) 

#the base configuration does not work
divergent_result <- setse_expanded(g_prep, k = "weight", tstep = 0.1)

#with a smaller timestep the algorithm converges
convergent_result <- setse_expanded(g_prep, k = "weight", tstep = 0.01)

## Not run: 
library(ggplot2)
#plot the results for a given node
convergent_result %>%
 ggplot(aes(x = t, y = net_force, colour = node)) + geom_line()
#re-plot with divergent_result to see what it looks like

## End(Not run)

rsetse documentation built on June 11, 2021, 5:07 p.m.