just use nv(g):
add_vertex!(g)
v = nv(g)
add_edge!(g, cur, v)
cur = v
The “more correct” way to do this is to understand that add_vertex! adds to to the end of the range that describes vertices, and use last(vertices(g)) instead of nv, but they’re essentially the same in terms of complexity.