| update_graph | R Documentation |
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.
update_graph(old_graph, verbose = TRUE)
old_graph |
A metric_graph object from an older version of the package |
verbose |
Logical. Print progress messages. Default is TRUE. |
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:
Extracting all components from the old graph
Creating a new graph with settings that minimize structural changes
Restoring all computed components (mesh, distances, etc.)
Re-adding observation data if present
A new metric_graph object compatible with the current package version
## Not run:
# 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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.