library(flownet)
# Create a simple graph
graph <- data.frame(
from = c(1, 2, 2, 3),
to = c(2, 3, 4, 4),
cost = c(1, 2, 3, 1)
)
# Compute distance matrix
dmat <- distances_from_graph(graph, cost.column = "cost")
dmat
Run the code above in your browser using DataLab