ShortestPaths {EpiContactTrace} | R Documentation |
ShortestPaths
Description
Methods for function ShortestPaths
in package EpiContactTrace
to get the shortest distance from/to the root given by the contact tracing.
Usage
ShortestPaths(x, ...)
## S4 method for signature 'ContactTrace'
ShortestPaths(x)
## S4 method for signature 'data.frame'
ShortestPaths(
x,
root,
tEnd = NULL,
days = NULL,
inBegin = NULL,
inEnd = NULL,
outBegin = NULL,
outEnd = NULL
)
Arguments
x |
a |
... |
Additional arguments to the method |
root |
vector of roots to calculate shortest path for. |
tEnd |
the last date to include ingoing movements. Defaults
to |
days |
the number of previous days before tEnd to include
ingoing movements. Defaults to |
inBegin |
the first date to include ingoing
movements. Defaults to |
inEnd |
the last date to include ingoing movements. Defaults
to |
outBegin |
the first date to include outgoing
movements. Defaults to |
outEnd |
the last date to include outgoing
movements. Defaults to |
Details
The contact tracing performs a depth first search starting at the
root. The ShortestPaths
gives the shortest distance from
root at each node. The network tree structure given by the depth
first search is shown by show
.
Value
A data.frame
with the following columns:
- root
The root of the contact tracing
- inBegin
-
If the direction is ingoing, then inBegin equals inBegin in
Trace
else NA. - inEnd
-
If the direction is ingoing, then inEnd equals inEnd in
Trace
else NA. - outBegin
-
If the direction is outgoing, then outBegin equals outBegin in
Trace
else NA. - outEnd
-
If the direction is outgoing, then outEnd equals outEnd in
Trace
else NA. - direction
-
If the direction is ingoing, then direction equals 'in' else 'out'
- source
-
The source of the contact at distance from root
- destination
-
The destination of the contact at distance from root
- distance
-
The shortest distance from/to root in the depth first search
Methods
signature(object = "ContactTrace")
-
Get the shortest paths for the ingoing and outgoing
Contacts
of aContactTrace
object. signature(x = "data.frame")
-
Get the shortest paths for a data.frame with movements, see details and examples.
See Also
show
and NetworkStructure
.
Examples
## Not run:
## Load data
data(transfers)
## Perform contact tracing
contactTrace <- Trace(movements = transfers,
root = 2645,
tEnd = "2005-10-31",
days = 90)
ShortestPaths(contactTrace)
## Calculate shortest paths for all included herds
## First extract all source and destination from the dataset
root <- sort(unique(c(transfers$source, transfers$destination)))
sp <- ShortestPaths(transfers,
root = root,
tEnd = "2005-10-31",
days = 90)
## End(Not run)