% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/metric_graph.R
\name{update_graph}
\alias{update_graph}
\title{Update an older version metric graph to the current package version}
\usage{
update_graph(old_graph, verbose = TRUE)
}
\arguments{
\item{old_graph}{A metric_graph object from an older version of the package}

\item{verbose}{Logical. Print progress messages. Default is TRUE.}
}
\value{
A new metric_graph object compatible with the current package version
}
\description{
This function creates a new metric_graph object from an existing one,
preserving all data, edge weights, mesh, distances, and other components while
ensuring compatibility with the current package version. The new graph is created
with minimal changes by disabling merges and other transformations.
}
\details{
This function is useful when loading metric graphs created with older
versions of the MetricGraph package. It ensures that all components (vertices,
edges, data, mesh, distances, etc.) are preserved while updating the internal
structure to be compatible with the current package version.

The function works by:
\itemize{
\item Extracting all components from the old graph
\item Creating a new graph with settings that minimize structural changes
\item Restoring all computed components (mesh, distances, etc.)
\item Re-adding observation data if present
}
}
\examples{
\dontrun{
# Load an old graph object
old_graph <- readRDS("old_graph.rds")

# Update to current version
new_graph <- update_graph(old_graph)

# Or use the method directly
new_graph <- old_graph$update_graph()
}

}
