## Create an 'SIR' model with example data.
model <- SIR(
u0 = u0_SIR(),
tspan = 1:1460,
events = events_SIR(),
beta = 0.16,
gamma = 0.077
)
## Calculate the in-degree for each node.
deg <- indegree(model)
## View the in-degree for the first 6 nodes.
head(deg)
## Plot the distribution of in-degrees across all nodes. This
## shows how many source nodes typically send individuals to a given
## node.
hist(
deg,
main = "Distribution of In-Degree (Unique Sources)",
xlab = "Number of Unique Source Nodes"
)
Run the code above in your browser using DataLab