networkflow provides a complete workflow to build, structure, and explore networks from tabular data.
Its key feature is a built-in dynamic analysis workflow: the package can build networks across time windows, detect clusters in each window, and link clusters across periods to track their evolution.
More broadly, networkflow supports the full analysis pipeline, from network construction to interpretation and visualization, including clustering, layout and color preparation, static plotting, and interactive exploration with a Shiny app.
The package was developed with projected networks in mind (for example, article -> reference), but it can also be used more generally once data are represented as tbl_graph objects.
The package includes:
- network construction (
build_network(),build_dynamic_networks()), - clustering and inter-temporal matching (
add_clusters(),merge_dynamic_clusters()), - interpretation (
name_clusters(),extract_tfidf()), - visualization (
layout_networks(),color_networks(),plot_networks()), - interactive exploration (
launch_network_app()).
For a full walkthrough, see:
Installation
You can install the development version from GitHub with:
install.packages("devtools")
devtools::install_github("agoutsmedt/networkflow")Quick start
library(networkflow)
nodes <- subset(Nodes_stagflation, source_type == "Stagflation")
references <- Ref_stagflation
g <- build_network(
nodes = nodes,
directed_edges = references,
source_id = "source_id",
target_id = "target_id",
projection_method = "structured",
cooccurrence_method = "coupling_similarity",
edges_threshold = 1,
keep_singleton = FALSE
)
g <- add_clusters(
graphs = g,
clustering_method = "leiden",
objective_function = "modularity",
seed = 123
)
g <- layout_networks(g, node_id = "source_id", layout = "kk")
g <- color_networks(g, column_to_color = "cluster_leiden")
plot_networks(
graphs = g,
x = "x",
y = "y",
cluster_label_column = "cluster_leiden",
node_size_column = NULL,
color_column = "color"
)