TL; DR: I would like to extract the border types of each path between two vertices in the graph. Is there a relatively reasonable way to do this?
The clinic in which I work recently conducted a fairly large (1,400 people) study of tuberculosis in high school. I have class schedules for all students and teachers (!) And are placed on the network (using igraph in R), with each student and each room-room combination being the top (for example, the class in Room 123 in Period 1 is the top with directed edge to the class that is in Room 123 for Period 2). I also know which rooms share the ventilation system - a plausible but unlikely infection mechanism. The graph is sent from a single source, so each path in the network has only two people - the source and the contact, separated by a variable number of vertices of space-time. Conceptually, there are four kinds of paths:
- personal contact (source β contact only)
- division of the general class (source β period-number β contact)
- next period exposure (source-> Room 123 Period 1 β Room 123 Period 2 β contact)
- Ventilation (source β Room 123 Period 1 β Room 125 Period 1 β contact)
Each edge has an attribute indicating whether it is an individual exposure, the same different period or ventilation boundary.
As an intermediate step in modeling the infection in this network, I would just like to get a simple count of the number of exhibits of each type that the student had. For example, a student could share a class with a source, and then was in the room in which the source was located, but after a while, and perhaps the next day was in the room associated with ventilation. These student indicators would be the following:
personal.contact: 0 shared.class: 1 next.period: 1 vent: 1
I'm not sure how best to get such information, although I see functions for getting the shortest paths, which makes it easier to identify personal contact links, but I think I need to evaluate all the paths (which seem crazy to ask for on a typical social network , but not so crazy when only the initial and indoor periods have extremes). If I could get to the point where each path from the source to the contact was represented by an ordered vector of edge types, I think I could easily match them to my criteria. I just donβt know how to get there. If igraph is not the right basis for this, and I just need to write some big horrible cycles according to the schedule of the students, so be it! But I would appreciate some advice before plunging into this hole.
Here is an example contact schedule for each of the three indirect paths:
source share