code: private void updateLastSeenEdge(Vertex v) {
      Edge lastSeenEdge = getLastSeenEdge();
      if (lastSeenEdge != null) {
        if (lastSeenEdge.getSourceVertexId() == null) {
          lastSeenEdge.setSourceVertexId(v.getId());
        } else if (lastSeenEdge.getTargetVertexId() == null) {
          lastSeenEdge.setTargetVertexId(v.getId());
        }
      }
    }
docs: Updates the source or target vertex identifier of the last seen edge.
  
  @param v current vertex