dodgr_insert_vertex {dodgr} | R Documentation |
Insert a new node or vertex into a network
Description
Insert a new node or vertex into a network
Usage
dodgr_insert_vertex(graph, v1, v2, x = NULL, y = NULL)
Arguments
graph |
A flat table of graph edges. Must contain columns labelled
|
v1 |
Vertex defining start of graph edge along which new vertex is to be inserted |
v2 |
Vertex defining end of graph edge along which new vertex is to be
inserted (order of |
x |
The |
y |
The |
Value
A modified graph with specified edge between defined start and end vertices split into two edges either side of new vertex.
See Also
Other misc:
compare_heaps()
,
dodgr_flowmap()
,
dodgr_full_cycles()
,
dodgr_fundamental_cycles()
,
dodgr_sample()
,
dodgr_sflines_to_poly()
,
dodgr_vertices()
,
merge_directed_graph()
,
summary.dodgr_dists_categorical()
,
write_dodgr_wt_profile()
Examples
graph <- weight_streetnet (hampi)
e1 <- sample (nrow (graph), 1)
v1 <- graph$from_id [e1]
v2 <- graph$to_id [e1]
# insert new vertex in the middle of that randomly-selected edge:
graph2 <- dodgr_insert_vertex (graph, v1, v2)
nrow (graph)
nrow (graph2) # new edges added to graph2