This function simplifies a Konigsbergr graph by reducing the graph to a simpler representation where intersections are directly connected by straight edges.

simplify_konigsbergr(graph, preserve_bridges = TRUE)



A Konigsbergr graph created from konigsberg_graph().


Boolean. Preserve full bridge geometry?


A simple, undirected igraph object.


This reduces to a simple, undirected graph, so note that the distinction between two-way and one-way roads will be discarded. The sum of the total distances of the removed edges are maintained, however. The real-world road distance in meters along an edge will be saved in the distance edge attribute of the new graph.

See also

This function relies on the simplify_topology() function from the pathfinder package.


if (FALSE) { boston_konigsbergr <- konigsberg_graph(boston) boston_sf <- graph_to_sf(boston_konigsbergr) plot(boston_sf$edges["geometry"]) simple_boston <- simplify_konigsbergr(boston_konigsbergr) simple_boston_sf <- graph_to_sf(simple_boston) plot(simple_boston_sf$edges["geometry"]) }