Skip to content

New example: Network visualization with ndtv #57

@smjenness

Description

@smjenness

Motivation

SISMID workshop materials cover network visualization with ndtv (networkDynamic Temporal Visualization), but the gallery has no example demonstrating it. Animated visualizations of disease spreading over a network are among the most powerful pedagogical tools for understanding network epidemics — they make abstract concepts like concurrency, bridging, and super-spreading visually intuitive. The ObservedNetworkData example already stores time-varying status attributes (the `testatus` TEA), making it a natural foundation.

Suggested Design

Disease Model: SIR on a Small Network

Use a small network (n = 50–100) so the visualization is legible, and SIR so the epidemic has a clear beginning, middle, and end (unlike endemic SIS which looks chaotic in animation).

Compartment Color in Visualization
S Blue
I Red
R Green

Custom Modules

Module Purpose
infection.FUN Standard S → I transmission; stores time-varying status on network via `activate.vertex.attribute()` for ndtv
recovery.FUN I → R recovery; updates time-varying status

The modules are deliberately minimal — the focus is on the visualization workflow, not complex disease dynamics.

Parameters

Parameter Description Suggested Value
inf.prob Per-act transmission probability 0.3 (high, for visible spread)
act.rate Acts per partnership per week 1
rec.rate Weekly recovery rate 0.05
i.num Initial infected 1–2 (seed epidemic from identifiable nodes)

ERGM Parameterization

The network must be small enough to visualize and structured enough to be interesting:

  • ~edges: Mean degree ~2.0 (enough edges to see transmission paths)
  • ~triangles or ~gwesp(0.5, fixed = TRUE): Clustering creates visible community structure in the layout — the disease spreads within clusters before jumping between them
  • ~isolates or ~degree(0): Minimize isolates so most nodes participate in the epidemic
  • Network size: n = 50–75 (large enough for interesting dynamics, small enough for legible plots)
  • Dissolution ~offset(edges): Long duration (~100 weeks) so the network is relatively stable during the animation

The small, clustered network makes the visualization compelling — you can see the epidemic move through one cluster, jump to another via a bridging edge, and then sweep through the second cluster.

Visualization Outputs

  1. Static network snapshots: Network at timesteps 1, 10, 25, 50 with nodes colored by disease status — shows epidemic progression as a series of frames
  2. Animated HTML visualization: Using `ndtv::render.d3movie()` to produce an interactive animation that can be viewed in a browser
  3. Transmission tree overlay: Highlight the edges along which transmission actually occurred (using EpiModel's transmission data frame)
  4. Static filmstrip: Side-by-side snapshots at key timepoints using `ndtv::filmstrip()`

Analyses

This is primarily a visualization example, but include:

  • Network plot at key epidemic phases (early spread, peak, post-peak)
  • Identification of the index case(s) and early transmission chain
  • Highlight super-spreader events (high-degree nodes that infect multiple partners)
  • Show how clustering creates heterogeneous epidemic timing across communities
  • Compare two runs: one where the epidemic dies out stochastically and one where it takes off — visualize why

Implementation Notes

The key technical requirement is storing time-varying disease status on the `networkDynamic` object using `activate.vertex.attribute()`, which the ObservedNetworkData example already demonstrates. This example would:

  1. Show the complete workflow from simulation to visualization
  2. Demonstrate `ndtv::compute.animation()` for computing network layouts
  3. Show `ndtv::render.d3movie()` for interactive HTML output
  4. Show `ndtv::filmstrip()` for static publication-quality figures

Dependencies: `ndtv` package (available on CRAN).

Relationship to Existing Examples

  • Builds on ObservedNetworkData's `activate.vertex.attribute()` pattern for time-varying attributes
  • Complements every other example — the visualization techniques shown here can be applied to any gallery model
  • Smallest network in the gallery (50–75 nodes vs. 500+ in other examples)
  • Most visual/pedagogical example — designed for presentations and teaching

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions