USCA

0th

Percentile

USCA312/USCA50 -- 312/50 cities in the US and Canada

The USCA312 dataset contains the distances between 312 cities in the US and Canada as an object of class TSP. USCA50 is a subset of USCA312 containing only the first 50 cities.

The USCA312_map dataset contains spatial data of the 312 cities.

Keywords
datasets
Usage
data("USCA312") data("USCA312_map") data("USCA50")
Details

For USCA312_map several packages for geographic data are needed (see Examples section).

We want to thank Roger Bivand for his help with plotting the map.

Format

USCA312 and USCA50 are objects of class TSP. USCA312_map contains in USCA312_coords the spatial coordinates of the 312 cities and in USCA312_basemap a part of the map of North America.

Source

John Burkardt, CITIES -- City Distance Datasets, Florida State University, Department of Scientific Computing

Aliases
  • USCA312
  • USCA312_map
  • USCA312_basemap
  • USCA312_coords
  • USCA50
Examples
data("USCA312")
data("USCA312_map")

## calculate a tour
tour <- solve_TSP(USCA312)
tour

## load map tools
library("maps")
library("sp")
library("maptools")

## plot map
plot(as(USCA312_coords, "Spatial"), axes=TRUE)
plot(USCA312_basemap, add=TRUE, col = "gray")


## plot tour and add cities
tour_line <- SpatialLines(list(Lines(list(
    Line(USCA312_coords[c(tour, tour[1]),])), ID="1")))

plot(tour_line, add=TRUE, col = "red")
points(USCA312_coords, pch=3, cex=0.4, col="black")
Documentation reproduced from package TSP, version 1.1-4, License: GPL-3

Community examples

Looks like there are no examples yet.