% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util.R
\name{match_mesh_data}
\alias{match_mesh_data}
\title{Match Data Frame Rows to Graph Mesh Order}
\usage{
match_mesh_data(
  graph,
  data,
  edge_col = ".edge_number",
  dist_col = ".distance_on_edge"
)
}
\arguments{
\item{graph}{A metric graph object with a mesh component containing VtE.}

\item{data}{A data.frame to be reordered. It must contain columns for
edge numbers and distances along those edges.}

\item{edge_col}{Character. Name of the column in \code{data} that contains the
edge numbers. Default: ".edge_number".}

\item{dist_col}{Character. Name of the column in \code{data} that contains the
distance along the edge for each point. Default: ".distance_on_edge".}
}
\value{
A reordered data.frame where rows correspond to the order of
points in \code{graph$mesh$VtE}. If the input \code{data} was an \code{sf} object,
the returned object will also be an \code{sf} object with its geometry
reordered accordingly.
}
\description{
Reorders the rows of a data frame to align with the specific ordering of points
along the edges of a metric graph's mesh. This ensures that data associated
with locations on the graph are correctly aligned with the graph's internal
mesh structure, which is essential for spatial operations and visualizations.
}
