removeVertexById method

GraphSnapshot<V> removeVertexById(
  1. V id
)

Implementation

GraphSnapshot<V> removeVertexById(V id) {
  final vertex = vertices[id];
  if (vertex != null) {
    final unmodified = vertices.map(VertexSnapshot.mapAsUnmodified)
      ..remove(vertex);
    return GraphSnapshot<V>(vertexSnapshots: {
      ...unmodified,
      vertex.id: VertexSnapshot<V>(vertex, state: SnapshotState.removed)
    });
  } else {
    return GraphSnapshot(
        vertexSnapshots: {...vertices.map(VertexSnapshot.mapAsUnmodified)});
  }
}