library(flownet)
# Create graph with non-consecutive node IDs
graph <- data.frame(
from = c(10, 20, 20),
to = c(20, 30, 40),
cost = c(1, 2, 3)
)
# Normalize to consecutive integers (1, 2, 3, 4)
graph_norm <- normalize_graph(graph)
graph_norm
Run the code above in your browser using DataLab