library(flownet)
# Convert segments to graph and make undirected
graph <- africa_segments |>
linestrings_from_graph() |>
linestrings_to_graph()
graph_undir <- create_undirected_graph(graph, FUN = "fsum")
# Fewer edges after removing directional duplicates
c(directed = nrow(graph), undirected = nrow(graph_undir))
Run the code above in your browser using DataLab