Description Usage Arguments Details Value Author(s) See Also Examples
Map network nodes to a continuous sequence
1 2 3 4 5 | map.highway.nodes(nodes, numZones )
## S3 method for class 'highway.node.map'
summary(object,...)
## S3 method for class 'highway.node.map'
print(x,...)
|
nodes |
An optional node specification, typically a |
numZones |
The number of zones (origins and destinations) in the network. The zones must have sequential numbers from |
object |
The |
x |
The |
... |
Additional arguments passed to generic methods |
map.highway.nodes builds a highway.node.map structure that can be used to convert a sequence of
nodes with gaps to a compact sequence of integers with no missing values. The structure has functions to support
mapping and unmapping nodes, as illustrated in the examples.
map.highway.nodes needs to know the number of zones (origins or destinations) in the system, since
zones are never renumbered: they have to be continuous from 1 to however many zones there are, and
the input network will need to be edited if that is not the case.
Travel models are often coded to leave gaps in node number sequences in order to facilitate editing. Such gaps
cause performance problems when they are left in place, and map.highway.nodes is a simple tool for converting
an integer sequence with gaps into a continuous sequence, and recovering the original sequence later from the
continuous sequence.
Note:The standard R factor utility can also be used to construct a suitable node mapping, either alone or in
conjunction with map.highway.nodes. The sequence with gaps can be converted to a factor, and the resulting
factor codes will serve as a suitable sequence. Either approach can be used successfully, provided one carefully
handles zone numbering. In particular, if the maximum zone number in the original network is, say, 250, but
there is a range of numbers from 176 to 200 that are not used, then the correct value for the network
numZones parameter after applying the R function factor is 225. map.highway.nodes will catch this
situation and force the user to address it explicitly, saving much grief later on.
Returns a highway.node.map object, with two functions, map and unmap that can be used to
map and unmap nodes
Jeremy Raw
1 2 3 4 5 6 7 | numZones <- 5
bad.nodes <- c(1:numZones,round(runif(15,min=6,max=100)))
nodeMap <- map.highway.nodes(bad.nodes,numZones)
good.nodes <- nodeMap$map(bad.nodes)
bad.nodes.2 <- nodeMap$unmap(good.nodes)
results <- data.frame(Original=bad.nodes,Mapped=good.nodes,Unmapped=bad.nodes.2)
all( results$Original==results$Unmapped )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.