Revert a contracted graph created with dodgr_contract_graph back to the full, uncontracted version. This function is mostly used for the side effect of mapping any new columnns inserted on to the contracted graph back on to the original graph, as demonstrated in the example.

dodgr_uncontract_graph(graph)

Arguments

graph

A list of two items returned from dodgr_contract_graph, the first ("graph") containing the contracted graph, and the second ("edge_map") mapping edges in the contracted graph back to those in the original graph.

Value

A single data.frame representing the original, uncontracted graph.

Examples

graph0 <- weight_streetnet (hampi) nrow (graph0) # 5,729
#> [1] 5845
graph1 <- dodgr_contract_graph (graph0) nrow (graph1$graph) # 764
#> [1] 786
graph2 <- dodgr_uncontract_graph (graph1) nrow (graph2) # 5,729
#> [1] 5845
identical (graph0, graph2) # TRUE
#> [1] TRUE
# Insert new data on to the contracted graph and uncontract it: graph1$graph$new_col <- runif (nrow (graph1$graph)) graph3 <- dodgr_uncontract_graph (graph1) # graph3 is then the uncontracted graph which includes "new_col" as well