I am trying to isolate contagion/diffusion cascades of infections in a network graph. For example if we create the following graph:
library(igraph)
set.seed(10)
g <- sample_gnp(20, 1/5)
g <- set_vertex_attr(graph = g, name = "infection_time", value = sample(seq(as.Date('2022/01/01'), as.Date('2023/01/01'), by="day"), 20))
plot(g)
In this example should node 3 become infected they may infect 12, as there is a connection, and 12 may infect 12, 13 etc. This is what I mean by a cascade. They must follow a temporal sequence. Therefore, the cascade would be broken if none of the nodes they are directly linked to are infected after they are, i.e. 3 cannot cascade to 12 if 12 is already infected. None on the network recovers, so everyone starts out susceptible and at the end everyone is infected. In the real data there are many thousands of nodes, they are all connected, but have a varying degree, the network is non directed. However there are several seats or infection, i.e. node 4, 7, 20 may all become infected at different times without being infected by a neighbor, so what I am trying to test if the nodes were randomly popping up with infection in the network or if the infection was cascading through the network. It should also be noted the infection cannot travel in any other way than direct ties (i.e. dyadic spread not hyper-dyadic). Is there any simple way to isolate or extract these cascades? I am expecting to see some very long contagion cascades in the data given its size if it is taking place.