This internal function generates a graph representation from a set of warehouse coordinates by creating arcs (edges) between valid points.
create_arcs(coordinates)
A matrix with columns x_from
, y_from
, x_to
, y_to
, and distance
, representing the arcs of the graph.
A matrix or data frame with two columns representing the x and y coordinates of warehouse locations.
The function identifies valid arcs between coordinate pairs based on specific rules: - Arcs are created only for points that are aligned either horizontally or vertically. - Horizontal arcs are added only if they are on the warehouse boundaries (e.g., ground level or the top level). - Vertical arcs are created if there are no intermediate points between the two coordinates in the same column. - The distance of each arc is calculated based on the Manhattan distance.
The output graph is represented as a matrix, where each row corresponds to an arc and contains:
- x_from
: x-coordinate of the starting point.
- y_from
: y-coordinate of the starting point.
- x_to
: x-coordinate of the ending point.
- y_to
: y-coordinate of the ending point.
- distance
: Length of the arc.