R/wiki_graph.R

#' Data for producing graph
#'
#' A dataset containing the edges and weights of 6 nodes
#' 
#'
#' @format A data frame with 18 rows and 3 variables:
#' \describe{
#'   \item{v1}{Edges for the graph}
#'   \item{v2}{Edges for the graph}
#'   \item{w}{The weights}
#' }
#' 
#' @source \url{https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm}
"wiki_graph.rds"




# Creating data 

wiki_graph <-
  data.frame(v1=c(1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,6),
             v2=c(2,3,6,1,3,4,1,2,4,6,2,3,5,4,6,1,3,5),
             w=c(7,9,14,7,10,15,9,10,11,2,15,11,6,6,9,14,2,9))

saveRDS(wiki_graph, file = file.path("data","wiki_graph.rds"))
rebinhosini/AdvancedR documentation built on May 27, 2019, 4:01 a.m.