View source: R/layout_networks.R
layout_networks | R Documentation |
The function implements different layout algorithms from ggraph and graphlayouts. It also implements a dynamic process of computation of coordinates for list of tibble graphs, in order for the coordinates to be consistent between graphs.
layout_networks( graphs, node_id, layout, compute_dynamic_coordinates = FALSE, save_coordinates = FALSE, ... )
graphs |
A tibble graph from tidygraph, a list of tibble graphs or a data frame. |
node_id |
The column with the unique identifier of each node. |
layout |
The type of layout to create. All strings accepted by the algorithm argument can
also be supplied directly into layout. See |
compute_dynamic_coordinates |
When you have a list of tibble graphs and that some nodes are in multiple graphs,
you may want that each node in several graphs has relatively similar coordinates. Set
|
save_coordinates |
If you are running the function on the same object, the already existing columns |
... |
Additional arguments of the layout compatible with the function. See |
The function allows for the use of different layouts implemented in
ggraph and
graphlayouts. However, some
layout of graphlayouts
are not working with this function. Also, layouts do not
all take as input pre-determined coordinates, meaning that the
compute_dynamic_coordinates
argument does not work with all layout. Please check
if the layout used allows a parameter called coord
.
The same tibble graph or list of tibble graphs with a column x
and y
, and also
additional column x_{layout}
and y_{layout}
if you have set
save_coordinates
to TRUE
.
library(networkflow) nodes <- Nodes_stagflation |> dplyr::rename(ID_Art = ItemID_Ref) |> dplyr::filter(Type == "Stagflation") references <- Ref_stagflation |> dplyr::rename(ID_Art = Citing_ItemID_Ref) temporal_networks <- build_dynamic_networks(nodes = nodes, directed_edges = references, source_id = "ID_Art", target_id = "ItemID_Ref", time_variable = "Year", cooccurrence_method = "coupling_similarity", time_window = 20, edges_threshold = 1, overlapping_window = TRUE, filter_components = TRUE) temporal_networks <- layout_networks(temporal_networks, node_id = "ID_Art", layout = "fr", compute_dynamic_coordinates = TRUE) temporal_networks [[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.