remove method

VertexList remove(
  1. VertexNode vertex
)

Implementation

VertexList remove(VertexNode vertex) {
  if (vertex.prev == null) {
    head = vertex.next;
  } else {
    vertex.prev!.next = vertex.next;
  }

  if (vertex.next == null) {
    tail = vertex.prev;
  } else {
    vertex.next!.prev = vertex.prev;
  }

  return this;
}